Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015 #include "maxheap.h"
00016
00056 class Random: public MaxHeapOperators {
00057 private:
00058 long m_seed;
00059
00060 public:
00061
00063 UtilExport Random ();
00064
00065
00077 UtilExport void srand (unsigned int seed = 1);
00078
00084 UtilExport int rand ();
00085 UtilExport static const int s_rand_max;
00086
00097 inline int get(int max_exclusive = s_rand_max+1, int min_inclusive = 0) {
00098 return (this->rand() % (max_exclusive - min_inclusive) + min_inclusive);
00099 }
00100
00111 inline float getf(float max_exclusive = 1.0f, float min_inclusive = 0.0f) {
00112 return (this->rand() / (s_rand_max+1.0f) * (max_exclusive - min_inclusive) + min_inclusive);
00113 }
00114 };
00115