Skip to content

Instantly share code, notes, and snippets.

@wandrson
wandrson / TrueRandomSeed.ino
Last active February 2, 2024 05:37
This is a simple straightforward and relatively lightweight example of how to seed the internal PRNG function with a truly random value
// TrueRandomSeed.ino
// This example sketch shows how to provide a truly random seed value to the built in
// library pseudo random number generator. This ensures that your sketch will be
// using a different sequence of random numbers every time it runs. Unlike the
// usually suggested randomSeed(analogRead(0)) this method will provide a much more
// uniform and varied seed value. For more information about the basic technique used
// here to produce a random number or if you need more than one such number you can
// find a library, Entropy from the following web site along with documentation of how
// the library has been tested to provide TRUE random numbers on a variety of AVR
// chips and arduino environments.