Name

random()

Examples
for i in range(100): 
    r = random(50)
    stroke(r*5)
    line(50, i, 50+r, i)
for i in range(100): 
    r = random(-50, 50)
    print(r)
# Get a random element from an array
words = "apple", "bear", "cat", "dog"
index = int(random(len(words)))  # Same as int(random(4))
print(words[index])  # Prints one of the four words
Description
Syntax
random(high)
random(low, high)
Parameters
low
high
Related randomSeed()
noise()
Updated on Wed Jan 18 17:32:20 2017.
Creative Commons License