Hacker News new | ask | show | jobs
by andrew_v4 1892 days ago
Is there something specific about numpy here, or would it be any RNG?

I'm looking at some code that uses random.random() to randomly apply augmentations, I suspect that will have the same issue right?

1 comments

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.