diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-05-22 16:57:15 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-05-22 16:57:15 +0000 |
| commit | 2295579eb790d6eff6e54e84c01da6de10809a71 (patch) | |
| tree | 3d8282dedc137fee009f71ff904370537009e504 /src/experimental/random.cpp | |
| parent | 690ad7280e655654a3bcca2ca5ced9caacf75c8b (diff) | |
| download | libbu++-2295579eb790d6eff6e54e84c01da6de10809a71.tar.gz libbu++-2295579eb790d6eff6e54e84c01da6de10809a71.tar.bz2 libbu++-2295579eb790d6eff6e54e84c01da6de10809a71.tar.xz libbu++-2295579eb790d6eff6e54e84c01da6de10809a71.zip | |
Better win_o ignores. The random number system is pretty much together.
We need a few extra helper functions to cover some other good things, like
normalized floating point numbers, etc.
Diffstat (limited to '')
| -rw-r--r-- | src/experimental/random.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/experimental/random.cpp b/src/experimental/random.cpp index c792772..725948a 100644 --- a/src/experimental/random.cpp +++ b/src/experimental/random.cpp | |||
| @@ -4,5 +4,29 @@ | |||
| 4 | * This file is part of the libbu++ library and is released under the | 4 | * This file is part of the libbu++ library and is released under the |
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
| 6 | */ | 6 | */ |
| 7 | #include "bu/random.h" | ||
| 7 | 8 | ||
| 9 | #include "bu/randombasic.h" | ||
| 10 | |||
| 11 | Bu::Random::Random() : | ||
| 12 | pGen( NULL ) | ||
| 13 | { | ||
| 14 | pGen = new RandomBasic(); | ||
| 15 | } | ||
| 16 | |||
| 17 | Bu::Random::~Random() | ||
| 18 | { | ||
| 19 | delete pGen; | ||
| 20 | pGen = NULL; | ||
| 21 | } | ||
| 22 | |||
| 23 | int32_t Bu::Random::rand() | ||
| 24 | { | ||
| 25 | return getInstance().pGen->rand(); | ||
| 26 | } | ||
| 27 | |||
| 28 | void Bu::Random::seed( int32_t iSeed ) | ||
| 29 | { | ||
| 30 | getInstance().pGen->seed( iSeed ); | ||
| 31 | } | ||
| 8 | 32 | ||
