mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
added randf_from
This commit is contained in:
parent
83a2168fc1
commit
b75c43f7a4
6
game.cpp
6
game.cpp
@ -62,10 +62,12 @@ EX vector<int> hrandom_permutation(int qty) {
|
||||
/** Use \link hrngen \endlink to generate a floating point number between 0 and 1.
|
||||
*/
|
||||
|
||||
EX ld hrandf() {
|
||||
return (hrngen() - hrngen.min()) / (hrngen.max() + 1.0 - hrngen.min());
|
||||
EX ld randf_from(std::mt19937& r) {
|
||||
return (r() - r.min()) / (r.max() + 1.0 - r.min());
|
||||
}
|
||||
|
||||
EX ld hrandf() { return randf_from(hrngen); }
|
||||
|
||||
/** Returns an integer corresponding to the current state of \link hrngen \endlink.
|
||||
*/
|
||||
EX int hrandstate() {
|
||||
|
Loading…
Reference in New Issue
Block a user