Created
January 18, 2020 14:13
-
-
Save Astro36/be593eb9f0e10b2c0d4a87d0dcd14a85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const date = new Date(); | |
const seed = date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate(); | |
let nums = [...new Array(50).keys()]; // [0, 1, 2, 3, ..., 29]; | |
const rand = (() => { | |
let next = seed; | |
return () => (next = (1103515245 * next + 12345) % 10000000) % 3; | |
})(); | |
console.log(nums.sort((a, b) => rand() - 1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment