Advertisement
fernozzle

Thank you Jesus

Oct 7th, 2023
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. function getRandomChar() {
  2. const min = 0x1f300; // U+20000
  3. const max = 0x1f5ff; // U+2FFFF
  4. const randomCodePoint = Math.floor(Math.random() * (max - min + 1)) + min;
  5. return String.fromCodePoint(randomCodePoint);
  6. }
  7.  
  8. function getRandomColor() {
  9. const min = 0;
  10. const max = Math.pow(2, 24) - 1;
  11. return Math.floor(Math.random() * (max - min + 1)) + min;
  12. }
  13. function getRandomX() {
  14. return Math.floor(Math.random() * (200 - -200 + 1)) + -200;
  15. }
  16. function getRandomY() {
  17. return Math.floor(Math.random() * (100 - -100 + 1)) + -100;
  18. }
  19. function generateRandomValuesAndRun() {
  20. // Generate random values
  21. const randomChar = getRandomChar();
  22. const randomCharColor = getRandomColor();
  23. const randomBgColor = getRandomColor();
  24.  
  25. let randomX = getRandomX();
  26. let randomY = getRandomY();
  27. let info = getCharInfoXY(randomX, randomY);
  28.  
  29. // Call writeChar with random parameters
  30. writeCharToXY(randomChar, randomCharColor, randomX, randomY, randomBgColor);
  31. }
  32.  
  33.  
  34. // Call the function initially
  35. generateRandomValuesAndRun();
  36.  
  37. // Schedule the function to run every second
  38. setInterval(generateRandomValuesAndRun, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement