diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-05-23 00:39:31 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-05-23 00:39:31 +0000 |
commit | 20ee81a7b2d44ec985e99b4ee1bcd08fa25175d3 (patch) | |
tree | ec6174abd3a21f8d803d26267f9c03ddc468746e /src/stable/random.cpp | |
parent | ce793e31f387c0715fa5b50c20e06510cc3e95ff (diff) | |
download | libbu++-20ee81a7b2d44ec985e99b4ee1bcd08fa25175d3.tar.gz libbu++-20ee81a7b2d44ec985e99b4ee1bcd08fa25175d3.tar.bz2 libbu++-20ee81a7b2d44ec985e99b4ee1bcd08fa25175d3.tar.xz libbu++-20ee81a7b2d44ec985e99b4ee1bcd08fa25175d3.zip |
We have a nice selection of basic randomness functions now.
Diffstat (limited to '')
-rw-r--r-- | src/stable/random.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/stable/random.cpp b/src/stable/random.cpp index 725948a..63416bf 100644 --- a/src/stable/random.cpp +++ b/src/stable/random.cpp | |||
@@ -20,13 +20,28 @@ Bu::Random::~Random() | |||
20 | pGen = NULL; | 20 | pGen = NULL; |
21 | } | 21 | } |
22 | 22 | ||
23 | void Bu::Random::seed( int32_t iSeed ) | ||
24 | { | ||
25 | getInstance().pGen->seed( iSeed ); | ||
26 | } | ||
27 | |||
23 | int32_t Bu::Random::rand() | 28 | int32_t Bu::Random::rand() |
24 | { | 29 | { |
25 | return getInstance().pGen->rand(); | 30 | return getInstance().pGen->rand(); |
26 | } | 31 | } |
27 | 32 | ||
28 | void Bu::Random::seed( int32_t iSeed ) | 33 | int32_t Bu::Random::rand( int32_t iMax ) |
29 | { | 34 | { |
30 | getInstance().pGen->seed( iSeed ); | 35 | return getInstance().pGen->rand( iMax ); |
36 | } | ||
37 | |||
38 | int32_t Bu::Random::rand( int32_t iMin, int32_t iMax ) | ||
39 | { | ||
40 | return getInstance().pGen->rand( iMin, iMax ); | ||
41 | } | ||
42 | |||
43 | double Bu::Random::randNorm() | ||
44 | { | ||
45 | return getInstance().pGen->randNorm(); | ||
31 | } | 46 | } |
32 | 47 | ||