diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-14 18:50:53 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-14 18:50:53 +0000 |
commit | 14fd1e7eddebed74c04c94f0e583e6bc63fa9bbf (patch) | |
tree | 880aaa31f2795aa4f716453c2ef495e0f080a70e /STL/random.cpp | |
parent | 308424533b37cc4dc3b7fb7b9b006d206001fe08 (diff) | |
download | ATCD-0_8_3.tar.gz |
This commit was manufactured by cvs2svn to create tag 'v0_8_3'.v0_8_3
Diffstat (limited to 'STL/random.cpp')
-rw-r--r-- | STL/random.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/STL/random.cpp b/STL/random.cpp deleted file mode 100644 index 57ef645ae64..00000000000 --- a/STL/random.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company and Microsoft - * Corporation make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - */ - -#include <stddef.h> - -#define __SEED 161803398 - -class __random_generator { -protected: - unsigned long table[55]; - size_t index1; - size_t index2; -public: - unsigned long operator()(unsigned long limit) { - index1 = (index1 + 1) % 55; - index2 = (index2 + 1) % 55; - table[index1] = table[index1] - table[index2]; - return table[index1] % limit; - } - void seed(unsigned long j); - __random_generator(unsigned long j) { seed(j); } -}; - -void __random_generator::seed(unsigned long j) { - unsigned long k = 1; - table[54] = j; - for (size_t i = 0; i < 54; i++) { - size_t ii = 21 * i % 55; - table[ii] = k; - k = j - k; - j = table[ii]; - } - for (int loop = 0; loop < 4; loop++) { - for (i = 0; i < 55; i++) - table[i] = table[i] - table[(1 + i + 30) % 55]; - } - index1 = 0; - index2 = 31; -} - -__random_generator rd(__SEED); - -unsigned long __long_random(unsigned long limit) { - return rd(limit); -} |