GSDP:GAM100/CProcessing/random()
From Inside
< GSDP:GAM100 | CProcessing
Revision as of 18:54, 17 September 2018 by >Justin.chambers
random()
Description
Generate random decimal values from 0 to 1.0 inclusive.
Parameters
The function takes no parameters.
Return Value
The function returns a random floating-point value in the range [0, 1.0].
Example
void init()
{
size(200, 200);
background(200, 200, 200, 255);
strokeWeight(1.0f);
for (float i = 0; i < height; ++i)
{
int r = random() * 200;
stroke(r, 0, 0, 255);
line(0, i, r, i);
}
}
void update()
{
}