chipKIT® Development Platform

Inspired by Arduino™

Last edit: 2021-03-21 22:34 by Majenko

Random

  1. Synopsis

  2. Description

  3. Return Value

  4. Conforming To

  5. Examples

  6. See Also

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()