"Fossies" - the Fresh Open Source Software Archive

Member "xaralx/share/xaralx/doc/mtrand.txt" (10 Aug 2006, 2954 Bytes) of package /linux/misc/old/RecomXaraLX0.7_rev1692.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 // Mersenne Twister random number generator -- a C++ class MTRand
    2 // Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
    3 // Richard J. Wagner  v1.0  15 May 2003  rjwagner@writeme.com
    4 
    5 // The Mersenne Twister is an algorithm for generating random numbers.  It
    6 // was designed with consideration of the flaws in various other generators.
    7 // The period, 2^19937-1, and the order of equidistribution, 623 dimensions,
    8 // are far greater.  The generator is also fast; it avoids multiplication and
    9 // division, and it benefits from caches and pipelines.  For more information
   10 // see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html
   11 
   12 // Reference
   13 // M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
   14 // Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on
   15 // Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
   16 
   17 // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
   18 // Copyright (C) 2000 - 2003, Richard J. Wagner
   19 // All rights reserved.                          
   20 //
   21 // Redistribution and use in source and binary forms, with or without
   22 // modification, are permitted provided that the following conditions
   23 // are met:
   24 //
   25 //   1. Redistributions of source code must retain the above copyright
   26 //      notice, this list of conditions and the following disclaimer.
   27 //
   28 //   2. Redistributions in binary form must reproduce the above copyright
   29 //      notice, this list of conditions and the following disclaimer in the
   30 //      documentation and/or other materials provided with the distribution.
   31 //
   32 //   3. The names of its contributors may not be used to endorse or promote 
   33 //      products derived from this software without specific prior written 
   34 //      permission.
   35 //
   36 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   37 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   38 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   39 // A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
   40 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   41 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   42 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   43 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   44 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   45 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   46 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   47 
   48 // The original code included the following notice:
   49 //
   50 //     When you use this, send an email to: matumoto@math.keio.ac.jp
   51 //     with an appropriate reference to your work.
   52 //
   53 // It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu
   54 // when you write.
   55 
   56 // Not thread safe (unless auto-initialization is avoided and each thread has
   57 // its own MTRand object)