random(max) //Returns a (long) pseudo-random number between 0 (inclusive) and max (exclusive)
random(min, max) //Returns a (long) pseudo-random number between min (inclusive) and max (exclusive)
randomSeed(seed) //Initializes de pseudo-random number generator, causing it to start at a specified point in its sequence.
Parameter | Details |
---|---|
min | The minimum possible value (inclusive) to be generated by the random() function. |
max | The maximum possible value (exclusive) to be generated by the random() function. |
seed | The seed that will be used to shuffle the random() function. |
If randomSeed()
is called with a fixed value (eg. randomSeed(5)
), the sequence of random numbers generated by the sketch will repeat each time it is run. In most cases, a random seed is preferred, which can be obtained by reading an unconnected analog pin.