You are reading a single comment by @Stevie and its replies. Click here to read the full conversation.
  • 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.

    It all depends... on the intended purpose... for games/rolling dices: absolutely useless, for regression testing with values covering a range: perfect.

    Interesting what you verified and good to hear:

    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.

    The 'noise' in the ADC process has obviously the issue, and with the resolution and combination of multiple readings give already a good base.

    A few Javascript lines based on your observations, could that become a 95% solution?

  • It all depends... on the intended purpose... for games/rolling dices: absolutely useless, for regression testing with values covering a range: perfect.

    100% agree. That's why in C there is always a seed for the standard random generator. So it allows you to do both - and even for regression testing one might want to use different sequences just to be sure that the one sequence there is is not a lucky one... I never understood why JavaScript does not have it.

    A few Javascript lines based on your observations, could that become a 95% solution?

    I guess the lines above are good enough for that purpose. Either as it is or we could put this into a JavaScript module. Not sure. Do you have any opinion? For my purposes, the C version is what I want. I will certainly keep it around and use it, even if it is not integrated.

About

Avatar for Stevie @Stevie started