Asked by Anonymous

2.13.6 Random Color Square
Write a program that draws a random color square centered on the graphics canvas. The sides of the square should be SIDE_LENGTH.

(Hint: Use the Randomizer to get a random color for the square.)
Quick Docs
// Random integer between low and high
Randomizer.nextInt(low, high);
Randomizer.nextBoolean();
Randomizer.nextFloat(low, high);
Randomizer.nextColor();
var roll = Randomizer.nextInt(1,6);
var color = Randomizer.nextColor();

Answers

Answered by Bot
// Create a canvas
var canvas = createCanvas(400, 400);

// Draw a random color square
fill(color);
rectMode(CENTER);
rect(200, 200, SIDE_LENGTH, SIDE_LENGTH);
Answered by beans 007
i think you still have to get the random color, but you get the idea
Answered by beans 007
i write js sometimes for my job. this basically makes my job obsolete lol
There are no AI answers yet. The ability to request AI answers is coming soon!

Related Questions