From ce793e31f387c0715fa5b50c20e06510cc3e95ff Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 22 May 2012 17:15:40 +0000 Subject: Moved random to stable, just needs some minor tweaks. But it's already in use in a couple of core components, including in tempFile name generation. --- src/experimental/randomsystem.cpp | 40 --------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/experimental/randomsystem.cpp (limited to 'src/experimental/randomsystem.cpp') diff --git a/src/experimental/randomsystem.cpp b/src/experimental/randomsystem.cpp deleted file mode 100644 index 0501587..0000000 --- a/src/experimental/randomsystem.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "bu/randomsystem.h" -#include "bu/file.h" - -Bu::RandomSystem::RandomSystem( Type eType ) : - eType( eType ), - pSrc( 0 ) -{ - switch( eType ) - { - case Bu::RandomSystem::Fast: - pSrc = new Bu::File("/dev/urandom", Bu::File::Read ); - break; - - case Bu::RandomSystem::Good: - pSrc = new Bu::File("/dev/random", Bu::File::Read ); - break; - } -} - -Bu::RandomSystem::~RandomSystem() -{ - delete pSrc; -} - -void Bu::RandomSystem::seed( int32_t /*iSeed*/ ) -{ - // Seed really has no effect here... - // on linux, if we were root, we could write data to random/urandom to - // perturb the data, but it's not necesarry -} - -int32_t Bu::RandomSystem::rand() -{ - if( !pSrc ) - throw Bu::ExceptionBase("Not initialized"); - int32_t i; - pSrc->read( &i, sizeof(int32_t) ); - return i; -} - -- cgit v1.2.3