Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRandomChar() {
- const min = 0x1f300; // U+20000
- const max = 0x1f5ff; // U+2FFFF
- const randomCodePoint = Math.floor(Math.random() * (max - min + 1)) + min;
- return String.fromCodePoint(randomCodePoint);
- }
- function getRandomColor() {
- const min = 0;
- const max = Math.pow(2, 24) - 1;
- return Math.floor(Math.random() * (max - min + 1)) + min;
- }
- function getRandomX() {
- return Math.floor(Math.random() * (200 - -200 + 1)) + -200;
- }
- function getRandomY() {
- return Math.floor(Math.random() * (100 - -100 + 1)) + -100;
- }
- function generateRandomValuesAndRun() {
- // Generate random values
- const randomChar = getRandomChar();
- const randomCharColor = getRandomColor();
- const randomBgColor = getRandomColor();
- let randomX = getRandomX();
- let randomY = getRandomY();
- let info = getCharInfoXY(randomX, randomY);
- // Call writeChar with random parameters
- writeCharToXY(randomChar, randomCharColor, randomX, randomY, randomBgColor);
- }
- // Call the function initially
- generateRandomValuesAndRun();
- // Schedule the function to run every second
- setInterval(generateRandomValuesAndRun, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement