You are reading a single comment by @Stevie and its replies. Click here to read the full conversation.
  • If you really want a random generator, you take a noisy diode or transistor signal... used that in early (encription) software to create secret code sequences years back with early 8-bit mPs in the signal corp in the army... (when every cycle was crucial). Instead of messing with the javascript syntax, you can run the random generator for a random time and take the current (real) time (as seed) into account. Agreed, it is not as random as other options, but it is unpredictable. In testing, predictable and nicely distributed 'random' values are required to run true regression, over and over, and that is the requirement what Math.random() is based of.

  • Hi allObjects,

    Math.random() is not random at all, because it will always create the same sequence after rebooting. So that's not really helpful at all. Gordon wrote he will add the possibility to seed it. That's a first step. The second is a hardware based random number generator which can be used to produce a seed for it which is truly random.

    As for the diodes: Yes, that's pretty much the idea. But in my experience just taking the analog reading of a diode as such won't be enough. You need to collect the least significant bits of multiple readings to get something less predictable. So instead of letting everyone write the code and mess around with diodes, there can be a library and it can be based on the analog reference instead of diodes, so no external parts needed at all.

    I tried to find out if the analog reference is random enough to give a good seed. Which it apparently is - at least good enough for me.

About

Avatar for Stevie @Stevie started