aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-04-07 14:08:27 +0000
committerlloyd <[email protected]>2008-04-07 14:08:27 +0000
commit9ec64ce60cad6c825b7cf40306a359d019e2c13c (patch)
treeb6bbaab35eb09bf7148541baef89701ccefcfcce /src/libstate.cpp
parentab95931a8161005c8fd8aecc6f2f59d182b86de8 (diff)
Remove the Global_RNG namespace, along with rng.h and rng.cpp. This was
essentially a facade for the RNG object living in the global library state. Rewrite all callers to directly invoke the global state object: this makes it more clear what functions are actually accessing mutable state outside of the normal reference graph (and thus, which functions will have to be altered in order to remove this dependency). Other facades remain in place for the configuration object and the memory allocator factory.
Diffstat (limited to 'src/libstate.cpp')
-rw-r--r--src/libstate.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstate.cpp b/src/libstate.cpp
index 7f0c41b83..5e440c103 100644
--- a/src/libstate.cpp
+++ b/src/libstate.cpp
@@ -142,6 +142,16 @@ void Library_State::randomize(byte out[], u32bit length)
}
/*************************************************
+* Get a byte from the global PRNG *
+*************************************************/
+byte Library_State::random()
+ {
+ byte out;
+ rng->randomize(&out, 1);
+ return out;
+ }
+
+/*************************************************
* Add a new entropy source to use *
*************************************************/
void Library_State::add_entropy_source(EntropySource* src, bool last_in_list)