xxxxxxxxxx
44
// See "Random"
// https://p5js.org/reference/
// Simple random
// random() - 0 up to but not including 1
// random(max) - 0 up to but not including max
// random(min, max) - min up to but not including max
// random([array]) - Pick a random element
// Gaussian random generates numbers that are close
// to the mean. It will deviate +- from the mean
// by the amount of standard deviation
// But it can go higher/lower
// randomGaussian() - mean of 0 and std dev of 1
// randomGaussian(mean) - std dev 1
// randomGaussian(mean, stddev)
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
// Random lines
for (let y = 0; y < 100; y++) {
// https://p5js.org/reference/#/p5/randomGaussian
let x = randomGaussian(50, 15);
line(50, y, x, y);
let x1 = randomGaussian(150, 15);
line(150, y, x1, y)
}
}