aboutsummaryrefslogtreecommitdiff
path: root/src/stable/random.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-05-23 00:39:31 +0000
committerMike Buland <eichlan@xagasoft.com>2012-05-23 00:39:31 +0000
commit20ee81a7b2d44ec985e99b4ee1bcd08fa25175d3 (patch)
treeec6174abd3a21f8d803d26267f9c03ddc468746e /src/stable/random.cpp
parentce793e31f387c0715fa5b50c20e06510cc3e95ff (diff)
downloadlibbu++-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.cpp19
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
23void Bu::Random::seed( int32_t iSeed )
24{
25 getInstance().pGen->seed( iSeed );
26}
27
23int32_t Bu::Random::rand() 28int32_t Bu::Random::rand()
24{ 29{
25 return getInstance().pGen->rand(); 30 return getInstance().pGen->rand();
26} 31}
27 32
28void Bu::Random::seed( int32_t iSeed ) 33int32_t Bu::Random::rand( int32_t iMax )
29{ 34{
30 getInstance().pGen->seed( iSeed ); 35 return getInstance().pGen->rand( iMax );
36}
37
38int32_t Bu::Random::rand( int32_t iMin, int32_t iMax )
39{
40 return getInstance().pGen->rand( iMin, iMax );
41}
42
43double Bu::Random::randNorm()
44{
45 return getInstance().pGen->randNorm();
31} 46}
32 47