I want to create a function that returns a random number in a given range, what is a secure way of doing that?
Asked
Active
Viewed 47 times
0
-
Secure against what? Is the number used by something important or just generate something generally unpredictable? – ThoriumBR Jan 10 '24 at 14:12
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jan 10 '24 at 16:24
-
If you can access javascript's web crypto api through typescript, then you may want to consider using the web crypto api's Crypto.getRandomValues() method to generate cryptographically secure random values. – mti2935 Jan 11 '24 at 08:37