mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
28 lines
605 B
Plaintext
28 lines
605 B
Plaintext
var colors = [
|
|
"red",
|
|
"orange",
|
|
"yellow",
|
|
"green",
|
|
"blue",
|
|
"violet",
|
|
"indigo"
|
|
];
|
|
|
|
fn getRainbowColor(index) {
|
|
return colors[index];
|
|
}
|
|
|
|
|
|
import standard;
|
|
import random;
|
|
|
|
var rng: opaque = createRandomGenerator(hash(clock()));
|
|
|
|
|
|
|
|
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
|
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
|
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
|
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|
|
print getRainbowColor(rng.generateRandomNumber() % colors.length());
|