how does this random number generator work? Is it ok to use a new instance in each thread?