Browse Source

Slightly improve random::uniform() performance.

tags/v1.1.4
Andrew Belt 5 years ago
parent
commit
6f67c376c0
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/random.cpp

+ 1
- 1
src/random.cpp View File

@@ -50,7 +50,7 @@ uint64_t u64() {

float uniform() {
// 24 bits of granularity is the best that can be done with floats while ensuring that the return value lies in [0.0, 1.0).
return (xoroshiro128plus_next() >> (64 - 24)) / std::pow(2, 24);
return xoroshiro128plus_next() / std::pow(2.f, 64);
}

float normal() {


Loading…
Cancel
Save