use phosg random functions

This commit is contained in:
Martin Michelsen
2018-11-10 19:55:51 -08:00
parent 05d74ce496
commit 86243bd2e2
5 changed files with 51 additions and 53 deletions
+2 -3
View File
@@ -1,6 +1,7 @@
#include "RareItemSet.hh"
#include <phosg/Filesystem.hh>
#include <phosg/Random.hh>
using namespace std;
@@ -19,7 +20,5 @@ bool sample_rare_item(uint8_t pc) {
shift = 0;
}
uint32_t rate = ((2 << shift) * ((pc & 7) + 7));
uint32_t x = ((rand() << 30) | (rand() << 15) | rand());
return (x < rate);
return (random_object<uint32_t>() < rate);
}