DEV Community

loading...

Discussion on: 3 Amazing ways to generate random numbers without Math.random()

Collapse
epse profile image
Stef Pletinck

Modern cpus also tend to have randomness modules in them, that generally look at everything that is running and timing of interrupts, like key presses or WiFi packets.

Collapse
svijaykoushik profile image
Vijay Koushik, S. 👨🏽‍💻 Author

Thank you for pointing this out🖒. I didn't know about the randomness modules in CPUs 😰

Thread Thread
epse profile image
Stef Pletinck

They are generally exposed through the OS/Kernel's randomness functions, which are then used again in other languages and programs. I don't know if Math.rand() uses it or not though.

Thread Thread
artis3n profile image
Ari Kalfus

I don't want to toot my own horn, but I did write an article a while back on pseudo-randomness vs randomness in OS systems: dev.to/artis3n/random-vs-pseudorandom. You both may be interested in it.