Help - Search - Member List - Calendar
Full Version: c++ random numbers
nForums.net > Support > Software
Deepone
I found out this usefull class after searching for a bit, so I thought to let you all know about its existence smile.gif couldnt get normal means to work well so.. here's anyway a quote from the .h:

CODE
// This C++ code uses the simple, very fast "KISS" (Keep It Simple
// Stupid) random number generator suggested by George Marsaglia in a
// Usenet posting from 1999.  He describes it as "one of my favorite
// generators".  It generates high-quality random numbers that
// apparently pass all commonly used tests for randomness.  In fact, it
// generates random numbers by combining the results of three other good
// random number generators that have different periods and are
// constructed from completely different algorithms.  It does not have
// the ultra-long period of some other generators - a "problem" that can
// be fixed fairly easily - but that seems to be its only potential
// problem.  The period is about 2^123.


'http://finmath.uchicago.edu/~wilder/Code/random/ <- it can be seen here smile.gif

I had to make a bit of tweaking to make it compile on my university's g++ compiler which enforces pretty strict rules for ANSI-C++ and such things, for those who are interested.. the modified .h is available here (just removed the static consts and initiated the double's in the constructor):
'http://lair.ton.tut.fi/nforums/rng.h

(I'm not sure if I should put this to news instead, this isnt really a support request but rather sharing a solution to something)
captbics
Thanks DeepOne...I filed that away. I'm very new to C, and every example helps.

captbics
Bearsland
QUOTE (Deepone @ Jun 13 2004, 07:46 PM)
(I'm not sure if I should put this to news instead, this isnt really a support request but rather sharing a solution to something)

No, it's in the right place mate.

It's not news and the software/hardware forums are not just for support, but also for general discussion or software solutions and tips/tricks like this one.

~Bear smile.gif
Deepone
good to hear that mate smile.gif if I'll come by with something, I will post it up.. smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2025 Invision Power Services, Inc.