diff options
author | inoas <mail@inoas.com> | 2022-04-13 02:50:20 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-04-16 10:23:34 +0100 |
commit | 3402ff3617bcc12365a20e6f24c5e007656836e6 (patch) | |
tree | 7b37136ba9953624ef6c13ec33e9cdd943023f3f /src | |
parent | 620a564dbd0fc75f66ec2abcbbac5a56543cb5c5 (diff) | |
download | gleam_stdlib-3402ff3617bcc12365a20e6f24c5e007656836e6.tar.gz gleam_stdlib-3402ff3617bcc12365a20e6f24c5e007656836e6.zip |
cs
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam_stdlib.mjs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs index 6604bff..1286469 100644 --- a/src/gleam_stdlib.mjs +++ b/src/gleam_stdlib.mjs @@ -247,17 +247,17 @@ export function power(base, exponent) { } export function random_uniform() { - let random_uniform_result = Math.random(); - // With round-to-nearest-even behavior, the ranges claimed for the functions below + let random_uniform_result = Math.random(); + // With round-to-nearest-even behavior, the ranges claimed for the functions below // (excluding the one for Math.random() itself) aren't exact. // If extremely large bounds are chosen (2^53 or higher), // it's possible in extremely rare cases to calculate the usually-excluded upper bound. // Note that as numbers in JavaScript are IEEE 754 floating point numbers // See: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random> - // Because of this, we just loop 'until' we get a valid result where 0.0 <= x < 1.0: - if (random_uniform_result === 1.0) { - return random_uniform(); - } + // Because of this, we just loop 'until' we get a valid result where 0.0 <= x < 1.0: + if (random_uniform_result === 1.0) { + return random_uniform(); + } return random_uniform_result; } |