-
Is there a way to generate a random number from [0, 1), instead of [0, 1]? |
Beta Was this translation helpful? Give feedback.
Answered by
ilqvya
Oct 1, 2021
Replies: 1 comment
-
Well, for floating numbers you can try something like this
Depending on your precision requirements: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
zixin96
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well, for floating numbers you can try something like this
auto val = Random::get(0.f, 0.99999999f);
Depending on your precision requirements:
https://stackoverflow.com/a/13543600/5734836