diff options
Diffstat (limited to 'src/stable/random.cpp')
-rw-r--r-- | src/stable/random.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/stable/random.cpp b/src/stable/random.cpp new file mode 100644 index 0000000..725948a --- /dev/null +++ b/src/stable/random.cpp | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2012 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | #include "bu/random.h" | ||
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 | } | ||
32 | |||