News for hackers. Stuff that matters.
Re:Make Your Program Slower with Threads by loeg on Thursday June 06, 2024 @09:15PM (#40604348)
You can't seed each thread with the same value -- that's all you're saying, right?
Re:Make Your Program Slower with Threads by jayd16 on Thursday June 06, 2024 @09:23PM (#40604396)
Result distribution (like averaging to zero) only happens at scale. Even if you use a different seed every time you might not see the proper distribution when looking across different generator instances.
Re:Make Your Program Slower with Threads by loeg on Thursday June 06, 2024 @10:30PM (#40604754)
If you're running into contention with multiple threads on a shared PRNG, you're probably at sufficient scale.
Re:Make Your Program Slower with Threads by jayd16 on Friday June 07, 2024 @01:11AM (#40605529)
Sure. Just saying that, for example, if you spawn threads and use the thread ID as the seed but pull a single value per thread, that's not sufficient.
Re:Make Your Program Slower with Threads by pclmulqdq on Thursday June 06, 2024 @09:25PM (#40604407)
Correct, you must use different, uncorrelated seeds for each thread if you want this to work. You can seed them all from one CSPRNG, for example, or from the Linux entropy service.