1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Reference | random()

random(v1=None, v2=None)

DescriptionReturns a random number that can be assigned to a variable or a parameter. When no parameters are supplied, returns a floating-point (decimal) number between 0.0 and 1.0 (including 0.0 and 1.0). When one parameter is supplied, returns a number between 0 and this parameter. When two parameters are supplied, returns a number between the first and the second parameter. The random() command is useful for all sorts of operations, from random colors to lines with a random width.

Note: new random values are returned each time the script runs. The variation can be locked by supplying a custom random seed:
from random import seed

Returnsa random number (either an integer or floating-point) within the given boundaries
Tutorial Repetition

r = random() # returns a float between 0 and 1
r = random(2.5) # returns a float between 0 and 2.5 
r = random(-1.0, 1.0) # returns a float between -1.0 and 1.0
r = random(5) # returns an int between 0 and 5
r = random(1, 10) # returns an int between 1 and 10
# sets the fill to anything from 
# black (0.0,0,0) to red (1.0,0,0)
fill(random(), 0, 0)