Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It is a well-known trap that forked or threaded RNG's keep using the same seed. It can be called a feature, eg when you need to process different ranges, using the same sequence of random numbers for each range, but mostly it's a bug. You need to init your rng seed for each thread or fork to get different random sequences.

For splitting up sequential ranges, a good rng typically has an advance function to advance the seed for each range. So you can get reproducibility.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: