xxxxxxxxxx
38
let names = [
"Bailey","Candy","Christshon","Ethan", "Isabelle", "Korin", "Leon","Lucy","Mostafa", "Samantha","Skye","So Yeon", "Ty", "Van", "Winny"
]
let y;
let counter = 0;
let tsz = 30;
let order = [];
function setup() {
createCanvas(windowWidth, windowHeight);
console.log(names.length);
}
function draw() {
background(255, 255, 0);
textSize(tsz);
for (let i = 0; i < order.length; i++) {
text(order[i], 20, 50 + (i * tsz));
}
stroke(255, 0, 0);
line(0, (5 * tsz) + (tsz / 2), width, (5 * tsz) + (tsz / 2));
noStroke();
}
function mousePressed() {
let pair = [];
if (names.length > 0) {
let ind = floor(random(names.length));
order[counter] = names[ind];
names.splice(ind, 1);
}
console.log(order[counter]);
counter++;
}