IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> c++ random numbers

Deepone
post Jun 13 2004, 06:46 PM
Post #1
Ball Eat Champion! Dwarf on a Wharf Champion! Q Bert 2004 Champion! Teenage Mutant Ninja Turtles Brawl Champion! Western Shooter Champion!

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
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
Bearsland
post Jun 19 2004, 06:04 PM
Post #3
Lightning Pool Champion! Midi Golf Champion! Pepsi Pinball Champion! Pool Jam Champion!

Grumpy Old Man
****

Group: VIP Member
Posts: 494
Joined: 17-March 04
Tournaments Won: 2

From: London. UK
Member No.: 4



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 :)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Deepone
post Jun 19 2004, 08:44 PM
Post #4
Ball Eat Champion! Dwarf on a Wharf Champion! Q Bert 2004 Champion! Teenage Mutant Ninja Turtles Brawl Champion! Western Shooter Champion!

The One Deep Down
*****

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



good to hear that mate :) if I'll come by with something, I will post it up.. :)


--------------------
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 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 - 05:28 AM