Will Math.random repeat?
javascript, random
Solution
From reading MDN:
Note: Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the window.crypto.getRandomValues() method.
I would assume, that collisions are eventually possible.
Problem
For the different JavaScript implementations of `Math.random`: Putting aside memory and length issues, will the following eventually have an eternally repeating sequence of numbers (e.g. It only depends on an internal seed, and when that seed wraps back to its starting point the numbers will repeat)? ``` sequence = Math.random(); while(true){ sequence += ', ' + Math.random(); } ``` Will each client have the same repeating sequence (e.g. Clients don't incorporate client-specific data into the random number generation process)? I ask because if the possible sequence of numbers is a limited subset, things like generating UUIDs with Math.random will have a much greater chance of collision.