I have forgotten

• https://me.yahoo.com
COST (GBP)
1.98
0.00
0

Wich Hill

Random number generator class using the Wichmann-Hill algorithm.
Controller: CodeCogs

C++

Class WichHill

This class produces very good quality random numbers using the Wichmann-Hill algorithm. It produces uniformly distributed pseudo-random 32-bit values with period of


To give you an idea of the running time for each of the functions, here are the results for generating 100,000,000 random numbers on a 750MHz microprocessor :
• genReal 18 seconds
• genInt 44 seconds

floating point random numbers in the (0, 1) interval and then plotting them one versus the other. It shows that the distribution is indeed uniform.

References:

• B.A. Wichmann and I. D. Hill (1982). Algorithm AS 183: "An Efficient and Portable Pseudo-random Number Generator", Applied Statistics, 31, 188-190; Remarks: 34,p.198 and 35, p.89.
• The Newran03 random number generator library of Robert Davies, http://www.robertnz.net/nr03doc.htm

Example 1

The following example displays 20 random large integers. Obviously the output will always be the same as the seed of the generator A never changes.
#include <iostream>
#include <codecogs/statistics/random/wichhill.h>

int main() {
Stats::Random::WichHill A(0.146);

for (int i = 0; i < 20; ++i)
std::cout << A.genInt() << std::endl;
return 0;
}

Authors

Lucian Bentea (August 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

Members of WichHill

WichHill

 WichHill( double s = 0.46875 )[constructor]
 s Default value = 0.46875

GenReal

 doublegenReal( )
//! Generates an uniform floating point number in the (0, 1) interval (endpoints are excluded). /*!

SetSeed

 voidsetSeed( double s )
 s Seed must be in the (0, 1) interval (endpoints are excluded).