## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csutil/randomgen.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 1998-2005 by Jorrit Tyberghein
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public
    00015     License along with this library; if not, write to the Free
    00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017 */
    00018
    00019 #ifndef __CS_RNG_H__
    00020 #define __CS_RNG_H__
    00021
    00045 #include "csextern.h"
    00046 #include "cstypes.h"
    00047
    00058 class CS_CRYSTALSPACE_EXPORT csRandomGen
    00059 {
    00060   int i97, j97;
    00061   float u [98];
    00062   float c, cd, cm;
    00063
    00064 public:
    00066   csRandomGen ()
    00067   { Initialize (); }
    00069   csRandomGen (uint32 iSeed)
    00070   { Initialize (iSeed); }
    00071
    00073   void Initialize ();
    00075   void Initialize (uint32 iSeed);
    00076
    00078   float Get ()
    00079   { return RANMAR (); }
    00081   uint32 Get (uint32 iLimit);
    00082
    00084   bool SelfTest ();
    00085
    00086 private:
    00088   void InitRANMAR (uint32 ij, uint32 kl);
    00090   float RANMAR ();
    00091 };
    00092
    00093 #endif // __CS_RNG_H__