The random function returns a random number.
Returns a random number.
You need to give it an
max as an input. This
int is the biggest number you random is allowed to return to you as a result.
It returns an int between
0 and the the
// creates a variable called number // sets the number variable to a random value between 0-100 int number = random(100); // prints the number to Serial Serial.println(number);
This function is useful when you want to have unpredictable results. For example you could use
random(6) to simulate rolling a die.