Definition at line 7 of file Random.h.
Static Public Member Functions | |
| static void | init () |
| Init random generator. | |
| static int | randomInt (int bound) |
| static double | randomReal (double bound) |
| static unsigned char | aByte (unsigned int index) |
| Return a value from interval <0,255>. | |
|
|
Return a value from interval <0,255>.
Definition at line 54 of file Random.cpp. 00055 {
00056 return ms_randArray[index % ARRAY_SIZE];
00057 }
|
|
|
Init random generator.
Definition at line 20 of file Random.cpp. 00020 {
00021 srand( static_cast<unsigned>(time(NULL)) );
00022 for (int i = 0; i < ARRAY_SIZE; ++i) {
00023 ms_randArray[i] = randomInt(256);
00024 }
00025 }
|
|
|
Definition at line 32 of file Random.cpp. 00033 {
00034 if (bound == 0) {
00035 return 0;
00036 }
00037 return rand() % bound;
00038 }
|
|
|
Definition at line 44 of file Random.cpp. 00045 {
00046 return bound * rand() / (RAND_MAX + 1.0);
00047 }
|
1.4.2