From 223e2986ad7752d38ce24d1cbeff47db98df1ae3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 27 Nov 2012 17:42:41 +0000 Subject: Added a few comments and fixed a string unit test, it assumed hex would be upper case by default and now it's lower case. --- src/stable/randombase.h | 9 +++++++++ src/stable/randomcmwc.h | 6 ++++++ src/stable/randomsystem.h | 10 ++++++++++ src/unit/string.unit | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/stable/randombase.h b/src/stable/randombase.h index 946284f..953ccb8 100644 --- a/src/stable/randombase.h +++ b/src/stable/randombase.h @@ -11,6 +11,15 @@ namespace Bu { + /** + * Base class for random number generators. This provides some basic + * implementations of standard helper functions. If your specific random + * number generator does not use the full range of a 32 bit integer then + * you'll want to override at least randNorm() to correct the range. + * + * Random number generators are not thread safe on their own. See + * Bu::Random. + */ class RandomBase { public: diff --git a/src/stable/randomcmwc.h b/src/stable/randomcmwc.h index 50eb8c4..2e0b0e8 100644 --- a/src/stable/randomcmwc.h +++ b/src/stable/randomcmwc.h @@ -11,6 +11,12 @@ namespace Bu { + /** + * Complimentary Multiply With Carry random number generator. This is a + * simpler and faster generator than Mersenne Twister, but uses about as + * much memory. Many people think that it may be at least as good as + * Mersenne Twister, or better. + */ class RandomCmwc : public RandomBase { public: diff --git a/src/stable/randomsystem.h b/src/stable/randomsystem.h index 63b40f3..6692e58 100644 --- a/src/stable/randomsystem.h +++ b/src/stable/randomsystem.h @@ -12,6 +12,16 @@ namespace Bu { class File; + /** + * Access to operating system provided random number generation. On linux + * this will provide access to /dev/random or /dev/urandom depending on + * weather Fast or Good is selected. On Linux systems Good random number + * generation can block while organic sources are use to gather entropy, so + * Fast is the default, it will always provide a result. + * + * On Windows this uses the Windows system cryptographic level random number + * generation services. Or at least, it will when I get to it. Sorry. + */ class RandomSystem : public RandomBase { public: diff --git a/src/unit/string.unit b/src/unit/string.unit index ddd89a6..d7cc0c4 100644 --- a/src/unit/string.unit +++ b/src/unit/string.unit @@ -584,7 +584,7 @@ suite String test format2 { - unitTest( Bu::String("0x%{1}00").arg( 75, Bu::Fmt::hex() ).end() == "0x4B00" ); + unitTest( Bu::String("0x%{1}00").arg( 75, Bu::Fmt::hex() ).end() == "0x4b00" ); } } // 03F09CA4F58AC8CA0E80F0D9D409D0A60700A192270004BC3A99E91D0001034F544603362E35013103313130019CA4F58AC8CA0E0002830800002C4200008AC200EBF7D9D4090127BB010000E3 -- cgit v1.2.3