Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. var arrayOfSets = [new Set(), new Set(), new Set(), new Set(), new Set()]; //generates an array set numbers,
  2.  
  3. for (var i = 0; i < 5; i++) //creates a loop that starts at 0 through to 24
  4. {
  5. while(arrayOfSets[i].size < 5)
  6. {
  7. debugger;
  8. var minNum;
  9. var maxNum;
  10. if(i == 0)
  11. {
  12. minNum = 1;
  13. maxNum = 15;
  14. }
  15. else if(i == 1)
  16. {
  17. minNum = 16;
  18. maxNum = 30;
  19. }
  20. else if(i == 2)
  21. {
  22. minNum = 31;
  23. maxNum = 45;
  24. }
  25. else if(i == 3)
  26. {
  27. minNum = 46;
  28. maxNum = 60;
  29. }
  30. else if(i == 4)
  31. {
  32. minNum = 61;
  33. maxNum = 75;
  34. }
  35. let randomNumber = Math.floor(Math.random() * maxNum) +1; //creates a variable that holds a random number within the min/max threshholds
  36. arrayOfSets[i].add(randomNumber) //puts the number into the array
  37. }
  38. console.log(arrayOfSets[i])
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement