Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math.MAX_RANDOM_BITS #34

Open
Rudxain opened this issue Jul 23, 2023 · 0 comments
Open

Math.MAX_RANDOM_BITS #34

Rudxain opened this issue Jul 23, 2023 · 0 comments

Comments

@Rudxain
Copy link

Rudxain commented Jul 23, 2023

This constant is defined as "the maximum number of bits after the radix-point, that Math.random could return". The use-case is to predict how much "entropy-per-call" can be extracted from Math.random. This is especially useful when multiplying the returned number by something close to Number.MAX_SAFE_INTEGER, as it can be used to predict how much bias there will be.

Its value is expected to be either 52 or 53, as 52 is the mantissa-size, and 53 includes the implicit-bit. The value is implementation-dependent, and this is the main reason why this "constant" should exist, to prevent code from guessing entropy in unreliable ways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant