IPB

Welcome Guest ( Log In | Register )

[ Outline ] · Standard · Linear+

> c++ random numbers

Deepone
post Jun 13 2004, 06:46 PM
Post #1


The One Deep Down
*****

Group: Private Member
Posts: 1137
Joined: 12-May 04
From: Masala / Kirkkonummi / Finland
Member No.: 101



I found out this usefull class after searching for a bit, so I thought to let you all know about its existence :) 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 :)

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)

This post has been edited by Deepone: Jun 13 2004, 06:47 PM


--------------------
This person is best talked to with the help of a computer..
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topicStart Poll
Replies
captbics
post Jun 19 2004, 04:08 PM
Post #2


nFm [ Level 1 ]
***

Group: Full Member
Posts: 217
Joined: 24-April 04
Member No.: 90



Thanks DeepOne...I filed that away. I'm very new to C, and every example helps.

captbics


--------------------
O Captain! my Captain! our fearful trip is done,
The ship has weather'd every rack, the prize we sought is won... (Dead Poet's Society) (Walt Whitman)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicTopic OptionsStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
 

Lo-Fi Version Time is now: 2nd July 2025 - 09:53 PM