libcoyotl - A Library of C++ Tools

Created by Scott Robert Ladd at Coyote Gulch Productions.


kissrng.h
1//---------------------------------------------------------------------
2// Algorithmic Conjurings @ http://www.coyotegulch.com
3//
4// kissrng.cpp (libcoyotl)
5//
6// The popular "Keep It Simple Stupid" psuedorandom number generator.
7//
8//---------------------------------------------------------------------
9//
10// Copyright 1990-2005 Scott Robert Ladd
11//
12// This program is free software; you can redistribute it and/or modify
13// it under the terms of the GNU General Public License as published by
14// the Free Software Foundation; either version 2 of the License, or
15// (at your option) any later version.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the
24// Free Software Foundation, Inc.
25// 59 Temple Place - Suite 330
26// Boston, MA 02111-1307, USA.
27//
28//-----------------------------------------------------------------------
29//
30// For more information on this software package, please visit
31// Scott's web site, Coyote Gulch Productions, at:
32//
33// http://www.coyotegulch.com
34//
35//-----------------------------------------------------------------------
36
37#if !defined(LIBCOYOTL_KISSRNG_H)
38#define LIBCOYOTL_KISSRNG_H
39
40#include "prng.h"
41
42namespace libcoyotl
43{
45
50 class kissrng : public prng
51 {
52 private:
53 uint32_t m_x;
54 uint32_t m_y;
55 uint32_t m_z;
56 uint32_t m_c;
57
58 public:
60
65
67
72
74
78 virtual void init(uint32_t seed);
79
80 private:
82
86 void init_helper();
87
88 public:
90
94 virtual uint32_t get_rand();
95 };
96
97} // end namespace libcoyotl
98
99#endif
A STL-compatible array class.
Definition array.h:73
Implements KISS, a peudorandom number generator.
Definition kissrng.h:51
kissrng(uint32_t seed)
Default constructor, with optional seed.
kissrng()
Default constructor, reading seed from/dev/urandom or the time.
virtual void init(uint32_t seed)
Initializes the generator with "seed".
virtual uint32_t get_rand()
Get the next integer.
An abstract definition of a peudorandom number generator.
Definition prng.h:55

© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.