randomSeed(seed)
Sets a value, or seed, as the starting point for the random() function.
randomSeed(value); // sets ‘value’ as the random seed
Because the Arduino is unable to create a truly random number, randomSeed allows you to place a variable, constant, or other function into the random function, which helps to generate more random "random” numbers. There are a variety of different seeds, or functions, that can be used in this function including millis() or even analogRead() to read electrical noise through an analog pin.
random(max)
random(min, max)
The random function allows you to return pseudo-random numbers within a range specified by min and max values.
value = random(100, 200); // sets 'value' to a random
// number between 100-200
Note: Use this after using the randomSeed() function.
The following example creates a random value between 0-255 and outputs a PWM signal on a PWM pin equal to the random value:
int randNumber; // variable to store the random value
int led = 10; // LED with 220 resistor on pin 10
void setup() {} // no setup needed
void loop()
{
randomSeed(millis()); // sets millis() as seed
randNumber = random(255); // random number from 0-255
analogWrite(led, randNumber); // outputs PWM signal
delay(500); // pauses for half a second
}
random
NEURAL NETWORKS FOR 3D MOTION DETECTION FROM A SEQUENCE OF IMAGE FRAMES
-
NEURAL NETWORKS FOR 3D MOTION DETECTION FROM A SEQUENCE OF IMAGE FRAMES
In video surveillance, video signals from multiple remote locations are
displayed...