Sunday, June 26, 2016

Random Numbers

Interesting article on new random number generation methods.  Doesn't sound like it will be making it into my C# code anytime soon.  Reminds me of the interview question we setup using one of the shared online coding environments where the dev I was working with - who wasn't used to .NET (although this goes back to COM) did a for loop to generate random numbers and got the same number for each iteration of the loop when he ran the code.  Took an old dev like me to point out that depending on the algorithm, MS usually resorts to some time-based seed, so if your loop is too fast, you'll just get the same number.  You can put in a wait or call one of the reset/reseed functions (or pass in a seed) to "force" the randomness.  MS says it themselves, they use a "time-dependent seed value" and their algorithm is pseudo-random (https://msdn.microsoft.com/en-us/library/system.random(v=vs.110).aspx).

But back to some true randomness at http://phys.org/news/2016-06-algorithm-random.html - I think the idea that your randomness might lose its randomness because the other systems it relies on for randomness aren't truly random is interesting. I wonder if, at the heart of the matter, that means that all systems are crackable if you can understand the state of the objects that went into the end system.  That is, it's all obfuscation until you obfuscate to the point that the variables reach infinity.

"How do you know for sure that the measurement devices used to measure the physical system don't have some underlying predictability due to the way they were constructed? To overcome this problem, scientists have developed strict requirements on the devices, but these "device-independent" protocols are so strict that they are very slow at generating large amounts of random numbers."

I also think it's interesting that there is during (dynamic?) and post (static?) randomization, with the latter being computationally heavy and more akin to certification of randomization.  You have to wonder if some day someone with enough horsepower will discover that all the GUIDs generated by current systems aren't random and are discoverable and we'll be forced into a Year-2000 like situation where we have to recompute system ids and update them (and therefore have to update all the relationships - nasty).

No comments: