Random function in .Net not so random
by Mountain Computers Inc., Publication Date: Tuesday, May 7, 2019
View Count: 994, Keywords: Random Function, Not So Random, .Net, Hashtags: #RandomFunction #NotSoRandom #.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.
© 2024 myBlog™ v1.1 All rights reserved. We count views as reads, so let's not over think it.