Random function in .Net not so random
Published: Tuesday, May 7, 2019 written by Drew Jackson
View Count: 111
Keywords: Random Function, Not So Random, .Net
so I am spinning up 40 instances of a database processor randomly selecting records from the database, between 1 and 118 million, and guess what, after 10-15 instances, the random() does not play well. yet, after 20 instances, suddenly I start to see similar calls to the same records in the same second. the seed is fine, but the pull is the same. pre-tag the target as hit or miss, or post tag the target as a hit or miss.... hmmmm...
do i now need to randomize the seed too? folks discuss this and have come across this as well.
I had the same problem with generating tokens a few years back, and I would double seed two random functions and multiple and round to get unique tokens and keys from 1 to 10,000,000 and that was fine.
more to come...
if you found this article helpful, consider contributing $10, 20 an Andrew Jackson or so..to the author. more authors coming soon
FYI we use paypal or patreon, patreon has 3x the transaction fees, so we don't, not yet.
© 2020 myBlog™ v1.1 All rights reserved. We count views as reads, so let's not over think it.