random

概要

p5.jsリファレンス(参考情報)

[p5.js] random

サンプル

def setup
  background(220)
  (0...100).each do |i|
    r = random(50)
    stroke(r * 5)
    line(50, i, 50 + r, i)
  end
end
def setup
  background(220)
  (0...100).each do |i|
    r = random(-50, 50)
    line(50, i, 50 + r, i)
  end
end
def setup
  background(220)
  words = ['apple', 'bear', 'cat', 'dog']
  word = random(words)
  text(word, 10, 50)
end

構文

戻値