library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub maspypy/library

:warning: random/random_real.hpp

Depends on

Code

#include "random/base.hpp"

double random_real(double a, double b) {
  double x = RNG(0, 1 << 30);
  x /= (1 << 30);
  return a + (b - a) * x;
}
#line 1 "random/random_real.hpp"

#line 2 "random/base.hpp"

u64 RNG_64() {
  static u64 x_ = u64(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()) * 10150724397891781847ULL;
  x_ ^= x_ << 7;
  return x_ ^= x_ >> 9;
}

u64 RNG(u64 lim) { return RNG_64() % lim; }

ll RNG(ll l, ll r) { return l + RNG_64() % (r - l); }
#line 3 "random/random_real.hpp"

double random_real(double a, double b) {
  double x = RNG(0, 1 << 30);
  x /= (1 << 30);
  return a + (b - a) * x;
}
Back to top page