lean
Avril 4 years ago
parent 5c4b6180d5
commit 7269a99aa6
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -17,7 +17,7 @@ void RNG::bytes(unsigned char* ptr, std::size_t len)
bool RNG::chance() bool RNG::chance()
{ {
return next_long() <= 0; return chance(.5);
} }
bool RNG::chance(double d) bool RNG::chance(double d)

@ -12,8 +12,14 @@ namespace rng {
double d = rng.next_double(); double d = rng.next_double();
long l = rng.next_long(0, 100); long l = rng.next_long(0, 100);
std::array<bool, 10> ar;
for(auto& i : ar) i = rng.chance();
cout << "Sampled: " << d << endl; cout << "Sampled: " << d << endl;
cout << "Long: " << l << endl; cout << "Long: " << l << endl;
cout << "Bools: [ ";
for(const auto& i : ar) cout << i << " ";
cout << "]" << endl;
} }
} }

Loading…
Cancel
Save