Random

From chipKIT
Jump to: navigation, search

Synopsis

 long random(long howbig)
 long random(long howsmall, long howbig)

Description

random() generates a pseudo-random number between either 0 or howsmall, and howbig inclusive. The seed for the random number may be set using randomSeed().

Return Value

A random number.

Conforming To

random() conforms to the Arduino 1.6.x API.

Examples

A random number between 0 and 10:

 int rnum = random(10);

A random number between -20 and +20:

 int rnum = random(-20, 20);

See Also

map(), randomSeed()