Description
Generate a random long when this function is called.
Syntax
or
|
long random(long howsmall, long howbig) |
Parameters
long howbig – long number maximum size of the random number generated.
long howsmall – long number minimum size of the random number generated.
Returns
random number, between 0 and howbig-1
or
random number, between howsmall and howbig-1
Example
Fills screen with random numbers
1
2
3
4
5
6
7
8
9
10
11
12
13
|
void setup()
<br>{
<br> background(0,0,0); //this paints the whole background black
<br> stroke(255,255,255);
<br> fill(0,0,0);
<br>}
<br>
<br>void loop() {
<br> int x,y;
<br> x = random(40);
<br> y = random(24);
<br> text((char)(random(0,10)+'0'),x*8,y*10);
<br>} |
Related
none