aboutsummaryrefslogtreecommitdiff
path: root/src/stable/randombasic.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-05-22 17:15:40 +0000
committerMike Buland <eichlan@xagasoft.com>2012-05-22 17:15:40 +0000
commitce793e31f387c0715fa5b50c20e06510cc3e95ff (patch)
tree5b15972bdcbe7a26933e8158f52b29fb014dc421 /src/stable/randombasic.cpp
parent2295579eb790d6eff6e54e84c01da6de10809a71 (diff)
downloadlibbu++-ce793e31f387c0715fa5b50c20e06510cc3e95ff.tar.gz
libbu++-ce793e31f387c0715fa5b50c20e06510cc3e95ff.tar.bz2
libbu++-ce793e31f387c0715fa5b50c20e06510cc3e95ff.tar.xz
libbu++-ce793e31f387c0715fa5b50c20e06510cc3e95ff.zip
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.
Diffstat (limited to 'src/stable/randombasic.cpp')
-rw-r--r--src/stable/randombasic.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/stable/randombasic.cpp b/src/stable/randombasic.cpp
new file mode 100644
index 0000000..ac591be
--- /dev/null
+++ b/src/stable/randombasic.cpp
@@ -0,0 +1,31 @@
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
8#include "bu/randombasic.h"
9
10Bu::RandomBasic::RandomBasic() :
11 a( 6364136223846793005 ),
12 c( 1442695040888963407 ),
13 x( 0 )
14{
15}
16
17Bu::RandomBasic::~RandomBasic()
18{
19}
20
21void Bu::RandomBasic::seed( int32_t iSeed )
22{
23 c = iSeed;
24}
25
26int32_t Bu::RandomBasic::rand()
27{
28 x = (a*x + c);
29 return (int32_t)x;
30}
31