Documentation - LibraryRandom
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Documentation - LibraryRandom

  • 297 views
Uploaded on

Class for generating pseudo-random numbers whose main algorithms are: Linear congruential generator, Mersenne Twister and R250.

Class for generating pseudo-random numbers whose main algorithms are: Linear congruential generator, Mersenne Twister and R250.

More in: Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
297
On Slideshare
297
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Reference Manual Generated by Doxygen 1.6.3 Sun Dec 4 13:06:32 2011
  • 2. Contents 1 1 1.1 2 Namespace Index 1 Namespace List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1 3 Class Index 3 Class Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1 4 Class Index 5 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1 5 File Index 7 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5.1 RNG Namespace Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5.1.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5.1.2.1 6 Namespace Documentation 9 swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Class Documentation 11 6.1 RNG::BoxMuller Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 6.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.1.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 14 6.1.2.1 BoxMuller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.1.2.2 BoxMuller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.1.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 RNG::Distribution Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 6.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 6.2.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 18 6.2.2.1 18 6.1.3 6.2 Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  • 3. ii CONTENTS 6.2.2.2 Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 18 6.2.3.1 Bernoulli . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 6.2.3.2 Binomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 6.2.3.3 Chisquare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 6.2.3.4 Equilikely . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6.2.3.5 Erlang . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6.2.3.6 Exponential . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6.2.3.7 Geometric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.2.3.8 Lognormal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.2.3.9 Normal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 6.2.3.10 Pascal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 6.2.3.11 Poisson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6.2.3.12 Student . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6.2.3.13 Uniform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 RNG::MersenneTwisterDouble Class Reference . . . . . . . . . . . . . . . . . . . . . . . 25 6.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.3.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 27 6.3.2.1 MersenneTwisterDouble . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.3.2.2 MersenneTwisterDouble . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.3.2.3 MersenneTwisterDouble . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.3.2.4 ∼MersenneTwisterDouble . . . . . . . . . . . . . . . . . . . . . . . . . 27 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.3.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 RNG::MersenneTwisterDouble53 Class Reference . . . . . . . . . . . . . . . . . . . . . 29 6.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 6.4.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 31 6.4.2.1 MersenneTwisterDouble53 . . . . . . . . . . . . . . . . . . . . . . . . 31 6.4.2.2 MersenneTwisterDouble53 . . . . . . . . . . . . . . . . . . . . . . . . 31 6.4.2.3 MersenneTwisterDouble53 . . . . . . . . . . . . . . . . . . . . . . . . 31 6.4.2.4 ∼MersenneTwisterDouble53 . . . . . . . . . . . . . . . . . . . . . . . 31 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 31 6.4.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 RNG::MersenneTwisterDoubleClosed Class Reference . . . . . . . . . . . . . . . . . . . 33 6.5.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.5.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 35 6.2.3 6.3 6.3.3 6.4 6.4.3 6.5 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 4. CONTENTS iii 6.5.2.1 MersenneTwisterDoubleClosed . . . . . . . . . . . . . . . . . . . . . . 35 6.5.2.2 MersenneTwisterDoubleClosed . . . . . . . . . . . . . . . . . . . . . . 35 6.5.2.3 MersenneTwisterDoubleClosed . . . . . . . . . . . . . . . . . . . . . . 35 6.5.2.4 ∼MersenneTwisterDoubleClosed . . . . . . . . . . . . . . . . . . . . . 35 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6.5.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 RNG::MersenneTwisterDoubleOpened Class Reference . . . . . . . . . . . . . . . . . . . 37 6.6.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.6.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 39 6.6.2.1 MersenneTwisterDoubleOpened . . . . . . . . . . . . . . . . . . . . . 39 6.6.2.2 MersenneTwisterDoubleOpened . . . . . . . . . . . . . . . . . . . . . 39 6.6.2.3 MersenneTwisterDoubleOpened . . . . . . . . . . . . . . . . . . . . . 39 6.6.2.4 ∼MersenneTwisterDoubleOpened . . . . . . . . . . . . . . . . . . . . 39 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.6.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 RNG::MersenneTwisterInt32 Class Reference . . . . . . . . . . . . . . . . . . . . . . . . 41 6.7.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6.7.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 42 6.7.2.1 MersenneTwisterInt32 . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.7.2.2 MersenneTwisterInt32 . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.7.2.3 MersenneTwisterInt32 . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.7.2.4 ∼MersenneTwisterInt32 . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.7.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.7.3.2 rand_int32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.7.3.3 Seed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.7.3.4 Seed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 RNG::R250Base Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 6.8.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.8.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 46 6.8.2.1 R250Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.8.2.2 R250Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.8.3.1 myrand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.8.3.2 mysrand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.8.3.3 r250_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.5.3 6.6 6.6.3 6.7 6.7.3 6.8 6.8.3 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 5. iv CONTENTS 6.8.4 Member Data Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.8.4.1 r250_buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.8.4.2 r250_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6.8.4.3 seed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 RNG::R250Double Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6.9.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 6.9.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 51 6.9.2.1 R250Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.9.2.2 R250Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.9.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.10 RNG::R250Int Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6.10.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.10.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 54 6.10.2.1 R250Int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.10.2.2 R250Int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.10.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.10.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 6.10.3.2 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.11 RNG::RandomNumberGenerator Class Reference . . . . . . . . . . . . . . . . . . . . . . 56 6.11.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.11.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 57 6.11.2.1 RandomNumberGenerator . . . . . . . . . . . . . . . . . . . . . . . . 57 6.11.2.2 RandomNumberGenerator . . . . . . . . . . . . . . . . . . . . . . . . 57 6.11.2.3 ∼RandomNumberGenerator . . . . . . . . . . . . . . . . . . . . . . . 57 6.11.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.11.3.1 ClockRandomSeed . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.11.3.2 GetDouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 6.11.3.3 GetDouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 6.11.3.4 GetDouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.11.3.5 GetInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.11.3.6 GetInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.11.3.7 GetInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.11.3.8 InitSeed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 6.11.3.9 Random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 6.11.3.10 Seed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.9 6.9.3 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 6. CONTENTS 7 v File Documentation 63 7.1 RandomNumberGenerator.cxx File Reference . . . . . . . . . . . . . . . . . . . . . . . . 63 7.2 RandomNumberGenerator.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 7.3 RandomNumberGenerator.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . 72 7.4 RandomNumberGenerator.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 7.5 Sys-LibraryRandom.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 7.5.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 7.5.1.1 main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Sys-LibraryRandom.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 7.6 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 7. Chapter 1 Namespace Index 1.1 Namespace List Here is a list of all namespaces with brief descriptions: RNG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
  • 8. Chapter 2 Class Index 2.1 Class Hierarchy This inheritance list is sorted roughly, but not completely, alphabetically: RNG::MersenneTwisterInt32 . . . . . . . RNG::MersenneTwisterDouble . . . . RNG::MersenneTwisterDouble53 . . RNG::MersenneTwisterDoubleClosed RNG::MersenneTwisterDoubleOpened RNG::R250Base . . . . . . . . . . . . . RNG::R250Double . . . . . . . . . . RNG::R250Int . . . . . . . . . . . . . RNG::RandomNumberGenerator . . . . . RNG::BoxMuller . . . . . . . . . . . RNG::Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 25 29 33 37 45 49 52 56 11 16
  • 9. Chapter 3 Class Index 3.1 Class List Here are the classes, structs, unions and interfaces with brief descriptions: RNG::BoxMuller . . . . . . . . . . . RNG::Distribution . . . . . . . . . . RNG::MersenneTwisterDouble . . . RNG::MersenneTwisterDouble53 . . RNG::MersenneTwisterDoubleClosed RNG::MersenneTwisterDoubleOpened RNG::MersenneTwisterInt32 . . . . . RNG::R250Base . . . . . . . . . . . RNG::R250Double . . . . . . . . . . RNG::R250Int . . . . . . . . . . . . RNG::RandomNumberGenerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 16 25 29 33 37 41 45 49 52 56
  • 10. 6 Class Index Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 11. Chapter 4 File Index 4.1 File List Here is a list of all files with brief descriptions: RandomNumberGenerator.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RandomNumberGenerator.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sys-LibraryRandom.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 72 78
  • 12. 8 File Index Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 13. Chapter 5 Namespace Documentation 5.1 RNG Namespace Reference Classes • • • • • • • • • • • class RandomNumberGenerator class MersenneTwisterInt32 class MersenneTwisterDouble class MersenneTwisterDoubleClosed class MersenneTwisterDoubleOpened class MersenneTwisterDouble53 class R250Base class R250Int class R250Double class BoxMuller class Distribution Functions • template<typename T > void swap (T &a, T &b) 5.1.1 Detailed Description Namespace RandomNumberGenerator RNG - RandomNumberGenerator Namespace para os algoritmos de geracao de numeros pseudo-aleatórios em suas diversas implementacoes. 5.1.2 Function Documentation 5.1.2.1 template<typename T > void RNG::swap (T & a, T & b) [inline] Definition at line 686 of file RandomNumberGenerator.h.
  • 14. 10 00686 { T temp(a); Namespace Documentation a = b; b = temp; }; Here is the caller graph for this function: RNG::Distribution::Equilikely RNG::swap RNG::Distribution::Uniform Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 15. Chapter 6 Class Documentation 6.1 RNG::BoxMuller Class Reference #include <RandomNumberGenerator.h>
  • 16. 12 Class Documentation Inheritance diagram for RNG::BoxMuller: RNG::RandomNumberGenerator - _seed + RandomNumberGenerator() + RandomNumberGenerator() + InitSeed() + ClockRandomSeed() + Seed() + GetInt() + GetInt() + GetInt() + GetDouble() + Random() + GetDouble() + GetDouble() + ~RandomNumberGenerator() RNG::BoxMuller + BoxMuller() + BoxMuller() + operator()() Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 17. 6.1 RNG::BoxMuller Class Reference 13 Collaboration diagram for RNG::BoxMuller: RNG::RandomNumberGenerator - _seed + RandomNumberGenerator() + RandomNumberGenerator() + InitSeed() + ClockRandomSeed() + Seed() + GetInt() + GetInt() + GetInt() + GetDouble() + Random() + GetDouble() + GetDouble() + ~RandomNumberGenerator() RNG::BoxMuller + BoxMuller() + BoxMuller() + operator()() Public Member Functions • BoxMuller () • BoxMuller (unsigned long seed) • double operator() (double Mean, double StandardDev) 6.1.1 Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo a distribuição BoxMuller ou Forma Polar da Transformação Box-Muller, caracterizado como um método simples de geração de números aleatórios em distribução normal através de números aleatórios uniformemente distrbuídos, ou seja, o algoritmo converte sequências de distribuição uniforme U(0,1) em sequências com distribuição gaussiana N(0,1). Definition at line 535 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 18. 14 Class Documentation 6.1.2 Constructor & Destructor Documentation 6.1.2.1 RNG::BoxMuller::BoxMuller () [inline] Método construtor da classe de geracao de numeros aleatórios Definition at line 542 of file RandomNumberGenerator.h. 00542 : RandomNumberGenerator() {}; 6.1.2.2 RNG::BoxMuller::BoxMuller (unsigned long seed) [inline] Método construtor que recebe uma semente inicial Definition at line 547 of file RandomNumberGenerator.h. 00547 : RandomNumberGenerator(seed) {}; 6.1.3 Member Function Documentation 6.1.3.1 double RNG::BoxMuller::operator() (double Mean, double StandardDev) Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Esse método retorna números pseudo-aleatório reais distribuídos dentro intervalo compreendido entre 0 e 1. Parâmetros : Mean - Média , StandardDev - Desvio Padrão Classe para geração de números pseudo-aleatórios que tem como principal algoritmo a distribuição BoxMuller ou Forma Polar da Transformação Box-Muller, caracterizado como um método simples de geração de números aleatórios em distribução normal através de números aleatórios uniformemente distrbuídos, ou seja, o algoritmo converte sequências de distribuição uniforme U(0,1) em sequências com distribuição gaussiana N(0,1). Overload do operador () fazendo com que o objeto criado tenha um aspecto de objetofunção. Esse método retorna números pseudo-aleatório reais distribuídos dentro intervalo compreendido entre 0 e 1. Definition at line 448 of file RandomNumberGenerator.cxx. 00454 { 00455 float x1, x2, w, y1; 00456 static float y2; 00457 static bool use_last = false; 00458 00459 //Verifica se o valor usado deve ser o da última chamada 00460 if (use_last) 00461 { 00462 y1 = y2; 00463 use_last = false; 00464 } 00465 else 00466 { 00467 00468 //Calculo da localização do número dentro do intervalo passado 00469 do 00470 { 00471 x1 = 2.0 * GetDouble() - 1.0; 00472 x2 = 2.0 * GetDouble() - 1.0; 00473 w = x1 * x1 + x2 * x2; 00474 } 00475 while ( w >= 1.0 ); Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 19. 6.1 RNG::BoxMuller Class Reference 00476 00477 00478 00479 00480 w = sqrt( (-2.0 * log( w ) ) / w ); y1 = x1 * w; y2 = x2 * w; use_last = true; The documentation for this class was generated from the following files: • RandomNumberGenerator.h • RandomNumberGenerator.cxx Generated on Sun Dec 4 13:06:32 2011 by Doxygen 15
  • 20. 16 6.2 Class Documentation RNG::Distribution Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::Distribution: RNG::RandomNumberGenerator - _seed + RandomNumberGenerator() + RandomNumberGenerator() + InitSeed() + ClockRandomSeed() + Seed() + GetInt() + GetInt() + GetInt() + GetDouble() + Random() + GetDouble() + GetDouble() + ~RandomNumberGenerator() RNG::Distribution + Distribution() + Distribution() + Bernoulli() + Binomial() + Equilikely() + Geometric() + Pascal() + Poisson() + Uniform() + Exponential() + Erlang() + Normal() + Lognormal() + Chisquare() + Student() Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 21. 6.2 RNG::Distribution Class Reference 17 Collaboration diagram for RNG::Distribution: RNG::RandomNumberGenerator - _seed + RandomNumberGenerator() + RandomNumberGenerator() + InitSeed() + ClockRandomSeed() + Seed() + GetInt() + GetInt() + GetInt() + GetDouble() + Random() + GetDouble() + GetDouble() + ~RandomNumberGenerator() RNG::Distribution + Distribution() + Distribution() + Bernoulli() + Binomial() + Equilikely() + Geometric() + Pascal() + Poisson() + Uniform() + Exponential() + Erlang() + Normal() + Lognormal() + Chisquare() + Student() Public Member Functions • • • • • • • • • • • • • Distribution () Distribution (unsigned long seed) long Bernoulli (double probability=0.5) long Binomial (unsigned long limit_experiment, double probability=0.5) long Equilikely (long a, long b) unsigned long Geometric (double probability=0.5) long Pascal (unsigned long limit_experiment, double probability=0.5) long Poisson (double mean) double Uniform (double a, double b) double Exponential (double mean=0.5) double Erlang (long limit_experiment, double base) double Normal (double Mean, double StandarDev) double Lognormal (double a, double b) Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 22. 18 Class Documentation • double Chisquare (unsigned long limit_experiment) • double Student (unsigned long limit_experiment) 6.2.1 Detailed Description Classe para geração de números pseudo-aleatórios que possui em seu núcleo um gerador com distribuição uniforme - no caso específico dessa classe usaremos a ancestral RandomNumberGenerator para gerar essa distribuição uniforme e a partir desse ’motor’ iremos gerar os demais tipos de distribuição. Com isso teremos para a classe Distribuition 6 distribuições discretas : Generator Range (x) Mean Variance Bernoulli(p) x = 0,1 p p∗(1-p) Binomial(n, p) x = 0,...,n n∗p n∗p∗(1-p) Equilikely(a, b) x = a,...,b (a+b)/2 ((b-a+1)∗(b-a+1)-1)/12 Geometric(p) x = 0,... p/(1-p) p/((1-p)∗(1-p)) Pascal(n, p) x = 0,... n∗p/(1-p) n∗p/((1-p)∗(1-p)) Poisson(m) x = 0,... m m E sete distribuições contínuas : Uniform(a, b) a < x < b (a + b)/2 (b - a)∗(b - a)/12 Exponential(m) x > 0 m m∗m Erlang(n, b) x > 0 n∗b n∗b∗b Normal(m, s) all x m s∗s Lognormal(a, b) x > 0 (ver abaixo) Chisquare(n) x > 0 n 2∗n Student(n) all x 0 (n > 1) n/(n - 2) (n > 2) Para a Lognormal(a, b), sua média e sua variância serão dadas por: mean = exp(a + 0.5∗b∗b) variance = (exp(b∗b) - 1) ∗ exp(2∗a + b∗b) Definition at line 590 of file RandomNumberGenerator.h. 6.2.2 Constructor & Destructor Documentation 6.2.2.1 RNG::Distribution::Distribution () [inline] Método construtor da classe de geracao de numeros aleatórios Definition at line 597 of file RandomNumberGenerator.h. 00597 : RandomNumberGenerator() {}; 6.2.2.2 RNG::Distribution::Distribution (unsigned long seed) [inline] Método construtor que recebe uma semente inicial Definition at line 602 of file RandomNumberGenerator.h. 00602 : RandomNumberGenerator(seed) {}; 6.2.3 Member Function Documentation 6.2.3.1 long RNG::Distribution::Bernoulli (double probability = 0.5) Método que retorna 1 com probabilidade p ou 0 com probabilidade (1-p). Para isso p deverá estar compreendido no intervalo aberto 0.0 e 1.0 - (0.0, 1.0) Adotamos aqui 0.5 como 50% de chance do número randômico ser maior ou menor que o número internamente escolhido pelo método. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 23. 6.2 RNG::Distribution Class Reference 19 Classe para geração de números pseudo-aleatórios que possui em seu núcleo um gerador com distribuição uniforme - no caso específico dessa classe usaremos a ancestral RandomNumberGenerator para gerar essa distribuição uniforme e a partir desse ’motor’ iremos gerar os demais tipos de distribuição. Com isso Método que retorna 1 com probabilidade p ou 0 com probabilidade (1-p). Para isso ’p’ deverá estar compreendido no intervalo aberto 0.0 e 1.0 - (0.0, 1.0) Definition at line 495 of file RandomNumberGenerator.cxx. Here is the call graph for this function: RNG::Distribution::Bernoulli RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble Here is the caller graph for this function: RNG::Distribution::Bernoulli 6.2.3.2 RNG::Distribution::Binomial long RNG::Distribution::Binomial (unsigned long limit_experiment, double probability = 0.5) Método que retorna um inteiro distribuído de forma binomial entre 0 e limit Nota : use limit > 0 e 0.0 < probabilidade < 1.0 Definition at line 504 of file RandomNumberGenerator.cxx. 00507 : use limit > 0 e 0.0 < probabilidade < 1.0 00508 */ 00509 long Distribution::Binomial (unsigned long limit_experiment, double probability) Here is the call graph for this function: RNG::Distribution::Binomial 6.2.3.3 RNG::Distribution::Bernoulli RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble double RNG::Distribution::Chisquare (unsigned long limit_experiment) Método que retorna um número real com distribuição Chi-square. Nota: use limit_experiment > 0 Definition at line 630 of file RandomNumberGenerator.cxx. 00633 : use limit_experiment > 0 00634 **/ 00635 double Distribution::Chisquare(unsigned long limit_experiment) 00636 { 00637 unsigned long i; 00638 double z, x = 0.0; 00639 00640 for (i = 0; i < limit_experiment; i++) 00641 { 00642 z = Normal(0.0, 1.0); Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 24. 20 Class Documentation Here is the call graph for this function: RNG::Distribution::Chisquare RNG::Distribution::Normal RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble Here is the caller graph for this function: RNG::Distribution::Chisquare 6.2.3.4 RNG::Distribution::Student long RNG::Distribution::Equilikely (long a, long b) Método que retorna um inteiro eqüitativamente distribuído compreendido no intervalo semi-aberto (a,b]. Definition at line 515 of file RandomNumberGenerator.cxx. Here is the call graph for this function: RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble RNG::Distribution::Equilikely RNG::swap 6.2.3.5 double RNG::Distribution::Erlang (long limit_experiment, double base) Método que retorna um número real positivo com distribuição de Erlang. Nota: use limit_experiment > 0 e base > 0.0 Definition at line 582 of file RandomNumberGenerator.cxx. 00585 : use limit_experiment > 0 e base > 0.0 00586 **/ 00587 double Distribution::Erlang(long limit_experiment, double base) 00588 { Here is the call graph for this function: RNG::Distribution::Erlang 6.2.3.6 RNG::Distribution::Exponential RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble double RNG::Distribution::Exponential (double mean = 0.5) Método que retorna um número real positivo exponencialmente distribuído. Nota: use mean > 0.0 Definition at line 573 of file RandomNumberGenerator.cxx. 00576 : use mean > 0.0 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 25. 6.2 RNG::Distribution Class Reference 21 Here is the call graph for this function: RNG::Distribution::Exponential RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble Here is the caller graph for this function: RNG::Distribution::Erlang RNG::Distribution::Exponential RNG::Distribution::Poisson 6.2.3.7 unsigned long RNG::Distribution::Geometric (double probability = 0.5) Método que retorna um inteiro não negativo geometricamente distribuído. Nota: use 0.0 < p < 1.0 Definition at line 525 of file RandomNumberGenerator.cxx. 00528 : use 0.0 < p < 1.0 Here is the call graph for this function: RNG::Distribution::Geometric RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble Here is the caller graph for this function: RNG::Distribution::Geometric 6.2.3.8 RNG::Distribution::Pascal double RNG::Distribution::Lognormal (double a, double b) Método que retorna um número real com distribuição lognormal. Nota: use b > 0.0 Definition at line 621 of file RandomNumberGenerator.cxx. 00624 : use b > 0.0 Here is the call graph for this function: RNG::Distribution::Lognormal RNG::Distribution::Normal Generated on Sun Dec 4 13:06:32 2011 by Doxygen RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble
  • 26. 22 Class Documentation 6.2.3.9 double RNG::Distribution::Normal (double Mean, double StandarDev) Método que retorna um número real com distribuição normal (gaussiana). Nota: use StandardDev > 0.0 Definition at line 594 of file RandomNumberGenerator.cxx. 00597 : use StandardDev > 0.0 00598 **/ 00599 double Distribution::Normal(double Mean, double StandarDev) 00600 { 00601 const double p0 = 0.322232431088; const double q0 = 0.099348462606; 00602 const double p1 = 1.0; const double q1 = 0.588581570495; 00603 const double p2 = 0.342242088547; const double q2 = 0.531103462366; 00604 const double p3 = 0.204231210245e-1; const double q3 = 0.103537752850; 00605 const double p4 = 0.453642210148e-4; const double q4 = 0.385607006340e-2; 00606 double u, t, p, q, z; 00607 00608 u = Random(); 00609 00610 if (u < 0.5) t = sqrt(-2.0 * log(u)); 00611 else t = sqrt(-2.0 * log(1.0 - u)); 00612 00613 p = p0 + t * (p1 + t * (p2 + t * (p3 + t * p4))); 00614 q = q0 + t * (q1 + t * (q2 + t * (q3 + t * q4))); 00615 Here is the call graph for this function: RNG::Distribution::Normal RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble Here is the caller graph for this function: RNG::Distribution::Chisquare RNG::Distribution::Student RNG::Distribution::Normal RNG::Distribution::Lognormal 6.2.3.10 long RNG::Distribution::Pascal (unsigned long limit_experiment, double probability = 0.5) Método que retorna um inteiro não negativo com distribuição de Pascal. Nota: use n > 0 e 0.0 < p < 1.0 Definition at line 534 of file RandomNumberGenerator.cxx. 00537 : use n > 0 e 0.0 < p < 1.0 00538 **/ 00539 long Distribution::Pascal(unsigned long limit_experiment, double probability) Here is the call graph for this function: RNG::Distribution::Pascal RNG::Distribution::Geometric RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 27. 6.2 RNG::Distribution Class Reference 6.2.3.11 23 long RNG::Distribution::Poisson (double mean) Método que retorna um inteiro não negativo com distribuição de Poisson. Nota: use mean > 0 Definition at line 545 of file RandomNumberGenerator.cxx. 00548 : use mean > 0 00549 **/ 00550 long Distribution::Poisson(double mean) 00551 { 00552 double t = 0.0; 00553 long x = 0; 00554 00555 while (t < mean) 00556 { 00557 t += Exponential(1.0); Here is the call graph for this function: RNG::Distribution::Poisson 6.2.3.12 RNG::Distribution::Exponential RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble double RNG::Distribution::Student (unsigned long limit_experiment) Método que retorna um número real com distribuição Student-t. Nota: use limit_experiment > 0 Definition at line 648 of file RandomNumberGenerator.cxx. 00651 : use limit_experiment > 0 Here is the call graph for this function: RNG::Distribution::Chisquare RNG::Distribution::Student 6.2.3.13 RNG::Distribution::Normal RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble double RNG::Distribution::Uniform (double a, double b) Método que retorna um número real uniformemente distribuído entre a e b. Nota: use a < b. Definition at line 563 of file RandomNumberGenerator.cxx. 00566 00567 : use a < b. **/ Here is the call graph for this function: RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble RNG::Distribution::Uniform RNG::swap The documentation for this class was generated from the following files: Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 28. 24 Class Documentation • RandomNumberGenerator.h • RandomNumberGenerator.cxx Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 29. 6.3 RNG::MersenneTwisterDouble Class Reference 6.3 RNG::MersenneTwisterDouble Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::MersenneTwisterDouble: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDouble + MersenneTwisterDouble() + MersenneTwisterDouble() + MersenneTwisterDouble() + operator()() + ~MersenneTwisterDouble() - MersenneTwisterDouble() - operator=() Generated on Sun Dec 4 13:06:32 2011 by Doxygen 25
  • 30. 26 Class Documentation Collaboration diagram for RNG::MersenneTwisterDouble: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDouble + MersenneTwisterDouble() + MersenneTwisterDouble() + MersenneTwisterDouble() + operator()() + ~MersenneTwisterDouble() - MersenneTwisterDouble() - operator=() Public Member Functions • • • • • 6.3.1 MersenneTwisterDouble () MersenneTwisterDouble (unsigned long seed) MersenneTwisterDouble (const unsigned long ∗seed, int size) double operator() () ∼MersenneTwisterDouble () Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’Mersenne Twister Pseudo-random Number Generator’ que possui periodicidade de 2∧ 19937-1. A classe abaixo retorna números em ponto flutuante no intervalo semi-aberto [0,1). Definition at line 203 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 31. 6.3 RNG::MersenneTwisterDouble Class Reference 6.3.2 Constructor & Destructor Documentation 6.3.2.1 27 RNG::MersenneTwisterDouble::MersenneTwisterDouble () [inline] Método construtor da classe de geracao de numeros aleatorios Definition at line 210 of file RandomNumberGenerator.h. 00210 : MersenneTwisterInt32() {}; 6.3.2.2 RNG::MersenneTwisterDouble::MersenneTwisterDouble (unsigned long seed) [inline] Método construtor que recebe um chave de 32 bits como semente Definition at line 215 of file RandomNumberGenerator.h. 00215 : MersenneTwisterInt32(seed) {}; 6.3.2.3 RNG::MersenneTwisterDouble::MersenneTwisterDouble (const unsigned long ∗ seed, int size) [inline] Método construtor que recebe um array inteiro de 32 bits e o tamanho do array como semente de geração de números Definition at line 221 of file RandomNumberGenerator.h. 00222 : MersenneTwisterInt32(seed, size) {}; 6.3.2.4 RNG::MersenneTwisterDouble::∼MersenneTwisterDouble () [inline] Método destrutor da classe responsável por desalocar qualquer recurso previamente alocado retornando o mesmo ao sistema . Definition at line 235 of file RandomNumberGenerator.h. 00235 {}; 6.3.3 Member Function Documentation 6.3.3.1 double RNG::MersenneTwisterDouble::operator() () [inline] Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Reimplemented from RNG::MersenneTwisterInt32. Definition at line 228 of file RandomNumberGenerator.h. 00229 { return static_cast<double>(rand_int32()) * (1. / 4294967296.); } // divisão p or 2^32 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 32. 28 Class Documentation Here is the call graph for this function: RNG::MersenneTwisterDouble::operator() RNG::MersenneTwisterInt32::rand_int32 The documentation for this class was generated from the following file: • RandomNumberGenerator.h Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 33. 6.4 RNG::MersenneTwisterDouble53 Class Reference 6.4 RNG::MersenneTwisterDouble53 Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::MersenneTwisterDouble53: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDouble53 + MersenneTwisterDouble53() + MersenneTwisterDouble53() + MersenneTwisterDouble53() + operator()() + ~MersenneTwisterDouble53() - MersenneTwisterDouble53() - operator=() Generated on Sun Dec 4 13:06:32 2011 by Doxygen 29
  • 34. 30 Class Documentation Collaboration diagram for RNG::MersenneTwisterDouble53: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDouble53 + MersenneTwisterDouble53() + MersenneTwisterDouble53() + MersenneTwisterDouble53() + operator()() + ~MersenneTwisterDouble53() - MersenneTwisterDouble53() - operator=() Public Member Functions • • • • • 6.4.1 MersenneTwisterDouble53 () MersenneTwisterDouble53 (unsigned long seed) MersenneTwisterDouble53 (const unsigned long ∗seed, int size) double operator() () ∼MersenneTwisterDouble53 () Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’Mersenne Twister Pseudo-random Number Generator’ que possui periodicidade de 2∧ 19937-1. A classe abaixo retorna números em ponto flutuante com uma resolução de até 53 bits no intervalo semi-aberto [0,1) . Definition at line 369 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 35. 6.4 RNG::MersenneTwisterDouble53 Class Reference 6.4.2 Constructor & Destructor Documentation 6.4.2.1 31 RNG::MersenneTwisterDouble53::MersenneTwisterDouble53 () [inline] Método construtor da classe de geracao de numeros aleatorios Definition at line 376 of file RandomNumberGenerator.h. 00376 : MersenneTwisterInt32() {}; 6.4.2.2 RNG::MersenneTwisterDouble53::MersenneTwisterDouble53 (unsigned long seed) [inline] Método construtor que recebe uma chave de 32 bits como semente Definition at line 381 of file RandomNumberGenerator.h. 00381 : MersenneTwisterInt32(seed) {}; 6.4.2.3 RNG::MersenneTwisterDouble53::MersenneTwisterDouble53 (const unsigned long ∗ seed, int size) [inline] Método construtor que recebe um array inteiro de 32 bits e o tamanho do array como semente de geração de números Definition at line 387 of file RandomNumberGenerator.h. 00388 : MersenneTwisterInt32(seed, size) {}; 6.4.2.4 RNG::MersenneTwisterDouble53::∼MersenneTwisterDouble53 () [inline] Método destrutor da classe responsável por desalocar qualquer recurso previamente alocado retornando o mesmo ao sistema . Definition at line 404 of file RandomNumberGenerator.h. 00404 {}; 6.4.3 Member Function Documentation 6.4.3.1 double RNG::MersenneTwisterDouble53::operator() () [inline] Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Reimplemented from RNG::MersenneTwisterInt32. Definition at line 394 of file RandomNumberGenerator.h. 00395 00396 00397 { return (static_cast<double>(rand_int32() >> 5) * 67108864. + static_cast<double>(rand_int32() >> 6)) * (1. / 9007199254740992. ); 00398 } Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 36. 32 Class Documentation Here is the call graph for this function: RNG::MersenneTwisterDouble53::operator() RNG::MersenneTwisterInt32::rand_int32 The documentation for this class was generated from the following file: • RandomNumberGenerator.h Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 37. 6.5 RNG::MersenneTwisterDoubleClosed Class Reference 6.5 RNG::MersenneTwisterDoubleClosed Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::MersenneTwisterDoubleClosed: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDoubleClosed + MersenneTwisterDoubleClosed() + MersenneTwisterDoubleClosed() + MersenneTwisterDoubleClosed() + operator()() + ~MersenneTwisterDoubleClosed() - MersenneTwisterDoubleClosed() - operator=() Generated on Sun Dec 4 13:06:32 2011 by Doxygen 33
  • 38. 34 Class Documentation Collaboration diagram for RNG::MersenneTwisterDoubleClosed: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDoubleClosed + MersenneTwisterDoubleClosed() + MersenneTwisterDoubleClosed() + MersenneTwisterDoubleClosed() + operator()() + ~MersenneTwisterDoubleClosed() - MersenneTwisterDoubleClosed() - operator=() Public Member Functions • • • • • 6.5.1 MersenneTwisterDoubleClosed () MersenneTwisterDoubleClosed (unsigned long seed) MersenneTwisterDoubleClosed (const unsigned long ∗seed, int size) double operator() () ∼MersenneTwisterDoubleClosed () Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’Mersenne Twister Pseudo-random Number Generator’ que possui periodicidade de 2∧ 19937-1. A classe abaixo retorna números em ponto flutuante no intervalo fechado [0,1]. Definition at line 258 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 39. 6.5 RNG::MersenneTwisterDoubleClosed Class Reference 6.5.2 Constructor & Destructor Documentation 6.5.2.1 35 RNG::MersenneTwisterDoubleClosed::MersenneTwisterDoubleClosed () [inline] Método construtor da classe de geracao de numeros aleatorios Definition at line 264 of file RandomNumberGenerator.h. 00264 : MersenneTwisterInt32() {}; 6.5.2.2 RNG::MersenneTwisterDoubleClosed::MersenneTwisterDoubleClosed (unsigned long seed) [inline] Método construtor que recebe um chave de 32 bits como semente Definition at line 269 of file RandomNumberGenerator.h. 00270 : MersenneTwisterInt32(seed) {}; 6.5.2.3 RNG::MersenneTwisterDoubleClosed::MersenneTwisterDoubleClosed (const unsigned long ∗ seed, int size) [inline] Método construtor que recebe um array inteiro de 32 bits e o tamanho do array como semente de geração de números Definition at line 276 of file RandomNumberGenerator.h. 00277 : MersenneTwisterInt32(seed, size) {}; 6.5.2.4 RNG::MersenneTwisterDoubleClosed::∼MersenneTwisterDoubleClosed () [inline] Método destrutor da classe responsável por desalocar qualquer recurso previamente alocado retornando o mesmo ao sistema . Definition at line 290 of file RandomNumberGenerator.h. 00290 {}; 6.5.3 Member Function Documentation 6.5.3.1 double RNG::MersenneTwisterDoubleClosed::operator() () [inline] Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Reimplemented from RNG::MersenneTwisterInt32. Definition at line 283 of file RandomNumberGenerator.h. 00284 { return static_cast<double>(rand_int32()) * (1. / 4294967295.); } // divisão p or 2^32 - 1 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 40. 36 Class Documentation Here is the call graph for this function: RNG::MersenneTwisterDoubleClosed::operator() RNG::MersenneTwisterInt32::rand_int32 The documentation for this class was generated from the following file: • RandomNumberGenerator.h Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 41. 6.6 RNG::MersenneTwisterDoubleOpened Class Reference 6.6 RNG::MersenneTwisterDoubleOpened Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::MersenneTwisterDoubleOpened: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDoubleOpened + MersenneTwisterDoubleOpened() + MersenneTwisterDoubleOpened() + MersenneTwisterDoubleOpened() + operator()() + ~MersenneTwisterDoubleOpened() - MersenneTwisterDoubleOpened() - operator=() Generated on Sun Dec 4 13:06:32 2011 by Doxygen 37
  • 42. 38 Class Documentation Collaboration diagram for RNG::MersenneTwisterDoubleOpened: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDoubleOpened + MersenneTwisterDoubleOpened() + MersenneTwisterDoubleOpened() + MersenneTwisterDoubleOpened() + operator()() + ~MersenneTwisterDoubleOpened() - MersenneTwisterDoubleOpened() - operator=() Public Member Functions • • • • • 6.6.1 MersenneTwisterDoubleOpened () MersenneTwisterDoubleOpened (unsigned long seed) MersenneTwisterDoubleOpened (const unsigned long ∗seed, int size) double operator() () ∼MersenneTwisterDoubleOpened () Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’Mersenne Twister Pseudo-random Number Generator’ que possui periodicidade de 2∧ 19937-1. A classe abaixo retorna números em ponto flutuante no intervalo aberto (0,1). Definition at line 313 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 43. 6.6 RNG::MersenneTwisterDoubleOpened Class Reference 39 6.6.2 Constructor & Destructor Documentation 6.6.2.1 RNG::MersenneTwisterDoubleOpened::MersenneTwisterDoubleOpened () [inline] Método construtor da classe de geracao de numeros aleatorios Definition at line 320 of file RandomNumberGenerator.h. 00320 : MersenneTwisterInt32() {}; 6.6.2.2 RNG::MersenneTwisterDoubleOpened::MersenneTwisterDoubleOpened (unsigned long seed) [inline] Método construtor que recebe um chave de 32 bits como semente Definition at line 325 of file RandomNumberGenerator.h. 00326 : MersenneTwisterInt32(seed) {}; 6.6.2.3 RNG::MersenneTwisterDoubleOpened::MersenneTwisterDoubleOpened (const unsigned long ∗ seed, int size) [inline] Método construtor que recebe um array inteiro de 32 bits e o tamanho do array como semente de geração de números Definition at line 332 of file RandomNumberGenerator.h. 00333 : MersenneTwisterInt32(seed, size) {}; 6.6.2.4 RNG::MersenneTwisterDoubleOpened::∼MersenneTwisterDoubleOpened () [inline] Método destrutor da classe responsável por desalocar qualquer recurso previamente alocado retornando o mesmo ao sistema . Definition at line 346 of file RandomNumberGenerator.h. 00346 {}; 6.6.3 Member Function Documentation 6.6.3.1 double RNG::MersenneTwisterDoubleOpened::operator() () [inline] Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Reimplemented from RNG::MersenneTwisterInt32. Definition at line 339 of file RandomNumberGenerator.h. 00340 { return (static_cast<double>(rand_int32()) + .5) * (1. / 4294967296.); } // di visão por 2^32 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 44. 40 Class Documentation Here is the call graph for this function: RNG::MersenneTwisterDoubleOpened::operator() RNG::MersenneTwisterInt32::rand_int32 The documentation for this class was generated from the following file: • RandomNumberGenerator.h Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 45. 6.7 RNG::MersenneTwisterInt32 Class Reference 6.7 41 RNG::MersenneTwisterInt32 Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::MersenneTwisterInt32: RNG::MersenneTwisterInt32 -n -m - state -p - init + MersenneTwisterInt32() + MersenneTwisterInt32() + MersenneTwisterInt32() + Seed() + Seed() + operator()() + ~MersenneTwisterInt32() # rand_int32() - twiddle() - gen_state() - MersenneTwisterInt32() - operator=() RNG::MersenneTwisterDouble RNG::MersenneTwisterDouble53 RNG::MersenneTwisterDoubleClosed RNG::MersenneTwisterDoubleOpened + MersenneTwisterDouble() + MersenneTwisterDouble() + MersenneTwisterDouble() + operator()() + ~MersenneTwisterDouble() - MersenneTwisterDouble() - operator=() + MersenneTwisterDouble53() + MersenneTwisterDouble53() + MersenneTwisterDouble53() + operator()() + ~MersenneTwisterDouble53() - MersenneTwisterDouble53() - operator=() + MersenneTwisterDoubleClosed() + MersenneTwisterDoubleClosed() + MersenneTwisterDoubleClosed() + operator()() + ~MersenneTwisterDoubleClosed() - MersenneTwisterDoubleClosed() - operator=() + MersenneTwisterDoubleOpened() + MersenneTwisterDoubleOpened() + MersenneTwisterDoubleOpened() + operator()() + ~MersenneTwisterDoubleOpened() - MersenneTwisterDoubleOpened() - operator=() Public Member Functions • • • • • • • MersenneTwisterInt32 () MersenneTwisterInt32 (unsigned long seed) MersenneTwisterInt32 (const unsigned long ∗array, int size) void Seed (unsigned long seed) void Seed (const unsigned long ∗array, int size) unsigned long operator() () virtual ∼MersenneTwisterInt32 () Protected Member Functions • unsigned long rand_int32 () 6.7.1 Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’Mersenne Twister Pseudo-Random Number Generator’ que possui periodicidade de 2∧ 19937-1. A classe abaixo gera número pseudo-aleatórios em formato inteiro sem sinal. Definition at line 121 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 46. 42 Class Documentation 6.7.2 Constructor & Destructor Documentation 6.7.2.1 RNG::MersenneTwisterInt32::MersenneTwisterInt32 () Método construtor da classe de geracao de numeros aleatorios Definition at line 163 of file RandomNumberGenerator.cxx. 6.7.2.2 RNG::MersenneTwisterInt32::MersenneTwisterInt32 (unsigned long seed) Método construtor que recebe um chave de 32 bits como semente Definition at line 169 of file RandomNumberGenerator.cxx. 00169 { if (!init) Seed(5489UL); init = true; }; 00170 Here is the call graph for this function: RNG::MersenneTwisterInt32::MersenneTwisterInt32 6.7.2.3 RNG::MersenneTwisterInt32::Seed RNG::MersenneTwisterInt32::MersenneTwisterInt32 (const unsigned long ∗ array, int size) Método construtor que recebe um array inteiro de 32 bits e o tamanho do array como semente de geração de números. Um bom exemplo para uso com esse método seria : unsigned long init_seed[4]={0x123, 0x234, 0x345, 0x456}, length=4; MersenneTwisterInt32 mt(init_seed, length); Método construtor que recebe um array inteiro de 32 bits e o tamanho do array como semente de geração de números Definition at line 178 of file RandomNumberGenerator.cxx. Here is the call graph for this function: RNG::MersenneTwisterInt32::MersenneTwisterInt32 6.7.2.4 RNG::MersenneTwisterInt32::Seed RNG::MersenneTwisterInt32::∼MersenneTwisterInt32 () [virtual] Método destrutor da classe responsável por desalocar qualquer recurso previamente alocado retornando o mesmo ao sistema . Metodo destrutor da classe Definition at line 265 of file RandomNumberGenerator.cxx. 6.7.3 Member Function Documentation 6.7.3.1 unsigned long RNG::MersenneTwisterInt32::operator() () [inline] Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 47. 6.7 RNG::MersenneTwisterInt32 Class Reference 43 Reimplemented in RNG::MersenneTwisterDouble, RNG::MersenneTwisterDoubleClosed, RNG::MersenneTwisterDoubleOpened, and RNG::MersenneTwisterDouble53. Definition at line 186 of file RandomNumberGenerator.h. 00186 { return rand_int32(); } Here is the call graph for this function: RNG::MersenneTwisterInt32::operator() 6.7.3.2 RNG::MersenneTwisterInt32::rand_int32 unsigned long RNG::MersenneTwisterInt32::rand_int32 () [protected] Método que gera um inteiro randômico de 32 bits Definition at line 247 of file RandomNumberGenerator.cxx. 00253 { 00254 //Caso seja necessario um novo estado para o vetor de estados 00255 if (p == n) gen_state(); 00256 00257 //O método gen_state() é dividido para ser inline, porque ele só é 00258 //chamado uma vez a cada 624 chamadas de outro modo ele se tornaria muito 00259 //grande para ser implementado como método inline. 00260 unsigned long x = state[p++]; Here is the caller graph for this function: RNG::MersenneTwisterDouble53::operator() RNG::MersenneTwisterDoubleOpened::operator() RNG::MersenneTwisterInt32::rand_int32 RNG::MersenneTwisterDoubleClosed::operator() RNG::MersenneTwisterDouble::operator() RNG::MersenneTwisterInt32::operator() 6.7.3.3 void RNG::MersenneTwisterInt32::Seed (const unsigned long ∗ array, int size) Geração de semente através de um array de inteiros de 32 bits Definition at line 205 of file RandomNumberGenerator.cxx. 00211 { 00212 Seed(19650218UL); 00213 int i = 1, j = 0; 00214 00215 for (int k = ((n > size) ? n : size); k; --k) 00216 { 00217 state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525UL)) 00218 + array[j] + j; // non linear Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 48. 44 Class Documentation 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 6.7.3.4 state[i] &= 0xFFFFFFFFUL; // Para máquinas com mais de 32 bits ++j; j %= size; if ((++i) == n) { state[0] = state[n - 1]; i = 1; } } for (int k = n - 1; k; --k) { state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941UL)) - i; state[i] &= 0xFFFFFFFFUL; // Para máquinas com mais de 32 bits if ((++i) == n) { state[0] = state[n - 1]; i = 1; } } // O estado zero recebe 1 - assumindo um inicio de array não-nulo void RNG::MersenneTwisterInt32::Seed (unsigned long seed) Geração de semente através de um inteiro de 32 bits Definition at line 186 of file RandomNumberGenerator.cxx. 00192 { 00193 // Para máquinas com mais de 32 bits 00194 state[0] = seed & 0xFFFFFFFFUL; 00195 00196 // Looping que obtem a nova semente para geração de números 00197 for (int i = 1; i < n; ++i) 00198 { 00199 state[i] = 1812433253UL * (state[i - 1] ^ (state[i - 1] >> 30)) + i; 00200 state[i] &= 0xFFFFFFFFUL; // Para máquinas com mais de 32 bits Here is the caller graph for this function: RNG::MersenneTwisterInt32::Seed RNG::MersenneTwisterInt32::MersenneTwisterInt32 The documentation for this class was generated from the following files: • RandomNumberGenerator.h • RandomNumberGenerator.cxx Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 49. 6.8 RNG::R250Base Class Reference 6.8 45 RNG::R250Base Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::R250Base: RNG::R250Base + r250_index + r250_buffer + seed + R250Base() + R250Base() + r250_init() + myrand() + mysrand() RNG::R250Double + R250Double() + R250Double() + operator()() Public Member Functions • R250Base () • R250Base (unsigned long seed) • void r250_init (unsigned long seed) Static Public Member Functions • static unsigned myrand () • static void mysrand (unsigned newseed) Static Public Attributes • static int r250_index = 0 Generated on Sun Dec 4 13:06:32 2011 by Doxygen RNG::R250Int + R250Int() + R250Int() + operator()() + operator()()
  • 50. 46 Class Documentation • static unsigned int r250_buffer [250] • static unsigned long seed = 1 6.8.1 Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’R250’ que possui periodicidade de 2∧ 250-1. A classe abaixo serve como base para as demais classes que usarão o algoritmo R250. Definition at line 425 of file RandomNumberGenerator.h. 6.8.2 Constructor & Destructor Documentation 6.8.2.1 RNG::R250Base::R250Base () [inline] Método construtor da classe de geracao de numeros aleatorios Definition at line 435 of file RandomNumberGenerator.h. 00435 {}; 6.8.2.2 RNG::R250Base::R250Base (unsigned long seed) [inline] Método construtor que recebe uma chave como semente Definition at line 440 of file RandomNumberGenerator.h. 00440 { r250_init(seed); } Here is the call graph for this function: RNG::R250Base::R250Base RNG::R250Base::r250_init 6.8.3 Member Function Documentation 6.8.3.1 unsigned RNG::R250Base::myrand () [inline, static] Método que retorna um número pseudo aleatório no intervalo entre 0 e 32768 Produzindo a seguinte sequencia de números randômicos : 346, 130, 10982, 1090... (9996 numbers skipped) ...23369, 2020, 5703, 12762, 10828, 16252, 28648, 27041, 23444, 6604... Método que retorna um número pseudo-aleatório no intervalo entre 0 e 32768. Definition at line 306 of file RandomNumberGenerator.cxx. 6.8.3.2 void RNG::R250Base::mysrand (unsigned newseed) [inline, static] Inicializa a semente de geração rândomica usando o método de congruência linear Inicializa a semente de geração usando o método de congruência linear Definition at line 315 of file RandomNumberGenerator.cxx. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 51. 6.8 RNG::R250Base Class Reference 6.8.3.3 47 void RNG::R250Base::r250_init (unsigned long seed) Inicializa o gerador de números aleatórios. Definition at line 323 of file RandomNumberGenerator.cxx. 00329 { 00330 int j, k; 00331 unsigned int mask; 00332 unsigned int msb; 00333 00334 mysrand(seed); 00335 r250_index = 0; 00336 00337 for (j = 0; j < 250; j++) /* Fill the r250 buffer with 15-bit values */ 00338 r250_buffer[j] = myrand(); 00339 00340 for (j = 0; j < 250; j++) /* Set some of the MS bits to 1 */ 00341 if (myrand() > 16384) r250_buffer[j] |= 0x8000; 00342 00343 msb = 0x8000; /* To turn on the diagonal bit */ 00344 mask = 0xffff; /* To turn off the leftmost bits */ 00345 00346 for (j = 0; j < 16; j++) 00347 { 00348 k = 11 * j + 3; /* Select a word to operate on */ 00349 r250_buffer[k] &= mask; /* Turn off bits left of the diagonal */ Here is the caller graph for this function: RNG::R250Base::r250_init RNG::R250Base::R250Base 6.8.4 Member Data Documentation 6.8.4.1 unsigned int RNG::R250Base::r250_buffer [static] Initial value: { 15301,57764,10921,56345,19316,43154,54727,49252,32360,49582, 26124,25833,34404,11030,26232,13965,16051,63635,55860,5184, 15931,39782,16845,11371,38624,10328,9139,1684,48668,59388, 13297,1364,56028,15687,63279,27771,5277,44628,31973,46977, 16327,23408,36065,52272,33610,61549,58364,3472,21367,56357, 56345,54035,7712,55884,39774,10241,50164,47995,1718,46887, 47892,6010,29575,54972,30458,21966,54449,10387,4492,644, 57031,41607,61820,54588,40849,54052,59875,43128,50370,44691, 286,12071,3574,61384,15592,45677,9711,23022,35256,45493, 48913,146,9053,5881,36635,43280,53464,8529,34344,64955, 38266,12730,101,16208,12607,58921,22036,8221,31337,11984, 20290,26734,19552,48,31940,43448,34762,53344,60664,12809, 57318,17436,44730,19375,30,17425,14117,5416,23853,55783, 57995,32074,26526,2192,11447,11,53446,35152,64610,64883, 26899,25357,7667,3577,39414,51161,4,58427,57342,58557, 53233,1066,29237,36808,19370,17493,37568,3,61468,38876, 17586,64937,21716,56472,58160,44955,55221,63880,1,32200, 62066,22911,24090,10438,40783,36364,14999,2489,43284,9898, 39612,9245,593,34857,41054,30162,65497,53340,27209,45417, 37497,4612,58397,52910,56313,62716,22377,40310,15190,34471, 64005,18090,11326,50839,62901,59284,5580,15231,9467,13161, Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 52. 48 Class Documentation 58500,7259,317,50968,2962,23006,32280,6994,18751,5148, 52739,49370,51892,18552,52264,54031,2804,17360,1919,19639, 2323,9448,43821,11022,45500,31509,49180,35598,38883,19754, 987,11521,55494,38056,20664,2629,50986,31009,54043,59743 } Definition at line 429 of file RandomNumberGenerator.h. 6.8.4.2 int RNG::R250Base::r250_index = 0 [static] Definition at line 428 of file RandomNumberGenerator.h. 6.8.4.3 unsigned long RNG::R250Base::seed = 1 [static] Definition at line 430 of file RandomNumberGenerator.h. The documentation for this class was generated from the following files: • RandomNumberGenerator.h • RandomNumberGenerator.cxx Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 53. 6.9 RNG::R250Double Class Reference 6.9 RNG::R250Double Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::R250Double: RNG::R250Base + r250_index + r250_buffer + seed + R250Base() + R250Base() + r250_init() + myrand() + mysrand() RNG::R250Double + R250Double() + R250Double() + operator()() Generated on Sun Dec 4 13:06:32 2011 by Doxygen 49
  • 54. 50 Class Documentation Collaboration diagram for RNG::R250Double: RNG::R250Base + r250_index + r250_buffer + seed + R250Base() + R250Base() + r250_init() + myrand() + mysrand() RNG::R250Double + R250Double() + R250Double() + operator()() Public Member Functions • R250Double () • R250Double (unsigned long seed) • double operator() () 6.9.1 Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’R250’ que possui periodicidade de 2∧ 250-1. A classe abaixo retorna um número pseudo-aleatório real de precisão dupla no intervalo compreendido entre 0 e 1. Definition at line 506 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 55. 6.9 RNG::R250Double Class Reference 6.9.2 Constructor & Destructor Documentation 6.9.2.1 51 RNG::R250Double::R250Double () [inline] Método construtor da classe de geracao de numeros aleatórios Definition at line 512 of file RandomNumberGenerator.h. 00512 : R250Base() {}; 6.9.2.2 RNG::R250Double::R250Double (unsigned long seed) [inline] Método construtor que recebe uma semente inicial Definition at line 517 of file RandomNumberGenerator.h. 00517 : R250Base(seed) {}; 6.9.3 Member Function Documentation 6.9.3.1 double RNG::R250Double::operator() () Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Esse método retorna números pseudo-aleatório reais distribuídos dentro intervalo compreendido entre 0 e 1. Definition at line 414 of file RandomNumberGenerator.cxx. 00420 { 00421 register int j; 00422 register unsigned int new_rand; 00423 00424 // Verifica limites de salto - Wrap pointer around 00425 if (r250_index >= 147) j = r250_index - 147; 00426 else j = r250_index + 103; 00427 00428 new_rand = r250_buffer[r250_index] ^= r250_buffer[j]; 00429 00430 //Incrementa o ponteiro para o próximo salto dentro do vetor de sementes The documentation for this class was generated from the following files: • RandomNumberGenerator.h • RandomNumberGenerator.cxx Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 56. 52 6.10 Class Documentation RNG::R250Int Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::R250Int: RNG::R250Base + r250_index + r250_buffer + seed + R250Base() + R250Base() + r250_init() + myrand() + mysrand() RNG::R250Int + R250Int() + R250Int() + operator()() + operator()() Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 57. 6.10 RNG::R250Int Class Reference 53 Collaboration diagram for RNG::R250Int: RNG::R250Base + r250_index + r250_buffer + seed + R250Base() + R250Base() + r250_init() + myrand() + mysrand() RNG::R250Int + R250Int() + R250Int() + operator()() + operator()() Public Member Functions • • • • R250Int () R250Int (unsigned long seed) unsigned int operator() () unsigned int operator() (unsigned int maximum_limit) 6.10.1 Detailed Description Classe para geração de números pseudo-aleatórios que tem como principal algoritmo o ’R250’ que possui periodicidade de 2∧ 250-1. A classe abaixo retorna um número pseudo-aleatório inteiro sem sinal uniformemente distribuído no intervalo compreendido entre 0 e 65535. Definition at line 469 of file RandomNumberGenerator.h. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 58. 54 Class Documentation 6.10.2 Constructor & Destructor Documentation 6.10.2.1 RNG::R250Int::R250Int () [inline] Método construtor da classe de geracao de numeros aleatórios Definition at line 476 of file RandomNumberGenerator.h. 00476 : R250Base() {}; 6.10.2.2 RNG::R250Int::R250Int (unsigned long seed) [inline] Método construtor que recebe uma semente inicial Definition at line 481 of file RandomNumberGenerator.h. 00481 : R250Base(seed) {}; 6.10.3 Member Function Documentation 6.10.3.1 unsigned int RNG::R250Int::operator() (unsigned int maximum_limit) Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Retorna um determinado número k inteiro sem sinal uniformmente distribuído dentro do intervalo compreendido entre 0 e maximum_limit. Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Retorna um determinado número k inteiro sem sinal uniformmente distribuído dentro do intervalo compreendido entre 0 e limit. Definition at line 379 of file RandomNumberGenerator.cxx. 00385 { 00386 register int j; 00387 register unsigned int new_rand, limit; 00388 unsigned int n = maximum_limit; 00389 00390 // LImitede geração de números 00391 limit = (65535U/n)*n; 00392 00393 do 00394 { 00395 //Usando o operador que retorna numeros entre 0 e 65535 00396 new_rand = operator ()(); 00397 00398 // Verifica limites de salto - Wrap pointer around 00399 if (r250_index >= 147) j = r250_index - 147; 00400 else j = r250_index + 103; 00401 00402 new_rand = r250_buffer[r250_index] ^= r250_buffer[j]; 00403 00404 //Incrementa o ponteiro para o próximo salto dentro do vetor de sementes 00405 if (r250_index >= 249) r250_index = 0; 00406 else r250_index++; 00407 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 59. 6.10 RNG::R250Int Class Reference 6.10.3.2 55 unsigned int RNG::R250Int::operator() () Overload do operador () fazendo com que o objeto criado tenha um aspecto de objeto-função. Esse método retorna números pseudo-aleatório inteiros sem sinal uniformemente distribuídos dentro intervalo compreendido entre 0 e 65535. Definition at line 356 of file RandomNumberGenerator.cxx. 00362 { 00363 register int j; 00364 register unsigned int new_rand; 00365 00366 // Verifica limites de salto - Wrap pointer around 00367 if (r250_index >= 147) j = r250_index - 147; 00368 else j = r250_index + 103; 00369 00370 new_rand = r250_buffer[r250_index] ^= r250_buffer[j]; 00371 00372 //Incrementa o ponteiro para o próximo salto dentro do vetor de sementes The documentation for this class was generated from the following files: • RandomNumberGenerator.h • RandomNumberGenerator.cxx Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 60. 56 Class Documentation 6.11 RNG::RandomNumberGenerator Class Reference #include <RandomNumberGenerator.h> Inheritance diagram for RNG::RandomNumberGenerator: RNG::RandomNumberGenerator - _seed + RandomNumberGenerator() + RandomNumberGenerator() + InitSeed() + ClockRandomSeed() + Seed() + GetInt() + GetInt() + GetInt() + GetDouble() + Random() + GetDouble() + GetDouble() + ~RandomNumberGenerator() RNG::Distribution RNG::BoxMuller + BoxMuller() + BoxMuller() + operator()() + Distribution() + Distribution() + Bernoulli() + Binomial() + Equilikely() + Geometric() + Pascal() + Poisson() + Uniform() + Exponential() + Erlang() + Normal() + Lognormal() + Chisquare() + Student() Public Member Functions • • • • • • • • • RandomNumberGenerator () RandomNumberGenerator (unsigned long seed) void InitSeed (unsigned int seed=0) unsigned int ClockRandomSeed (unsigned int myseed=0) unsigned int Seed (void) unsigned int GetInt (void) unsigned int GetInt (unsigned int maximum_limit) unsigned int GetInt (unsigned int minimum_limit, unsigned int maximum_limit) double GetDouble (void) Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 61. 6.11 RNG::RandomNumberGenerator Class Reference • • • • 57 double Random (void) double GetDouble (double maximum_limit) double GetDouble (double minimum_limit, double maximum_limit) virtual ∼RandomNumberGenerator () 6.11.1 Detailed Description Classe para geracao de numeros pseudo-aleatorios que tem como principal algoritmo o ’Linear Congruential Generator’ [ou Gerador de Congruência Linear] da funcao rand() existente na biblioteca padrão. Definition at line 29 of file RandomNumberGenerator.h. 6.11.2 Constructor & Destructor Documentation 6.11.2.1 RNG::RandomNumberGenerator::RandomNumberGenerator () Método construtor da classe de geracao de numeros aleatorios Construtor da classe de geração de números aleatórios Definition at line 19 of file RandomNumberGenerator.cxx. 6.11.2.2 RNG::RandomNumberGenerator::RandomNumberGenerator (unsigned long seed) [inline] Método construtor que recebe como parâmetro uma semente incial Definition at line 42 of file RandomNumberGenerator.h. 00042 { InitSeed(seed); }; Here is the call graph for this function: RNG::RandomNumberGenerator::RandomNumberGenerator 6.11.2.3 RNG::RandomNumberGenerator::InitSeed RNG::RandomNumberGenerator::∼RandomNumberGenerator () [virtual] Método destrutor da classe responsável por desalocar qualquer recurso previamente alocado retornando o mesmo ao sistema . Metodo destrutor da classe Definition at line 132 of file RandomNumberGenerator.cxx. 6.11.3 Member Function Documentation 6.11.3.1 unsigned int RNG::RandomNumberGenerator::ClockRandomSeed (unsigned int myseed = 0) Método que retorna uma semente aleatória para geração de números baseada no clock/relógio interno local. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 62. 58 Class Documentation Método que retorna uma semente aleatoria baseada no clock interno Definition at line 33 of file RandomNumberGenerator.cxx. 00039 { 00040 /*Estrutura responsavel pelo armazenamento do horario local*/ 00041 /*utilizado na geracao da semente randômica*/ 00042 struct tm myTM; 00043 double divisor = 1; 00044 00045 //Semente baseada no tempo é sugerida se a fornecida for nula 00046 if (myseed == 0) return (time(0)*rand()); 00047 00048 /*Caso a semente inicial fornecida seja nula então usaremos a estrutura de*/ 00049 /*tempo local para geração da semente*/ 00050 mktime(&myTM); 00051 00052 /*Se a semente fornecida não for nula entao uma semente baseada no algoritmo 00053 *de divisao abaixo é fornecida*/ 00054 if ((myseed%2) == 0) 00055 { 00056 divisor = myseed + 0.13579; 00057 return (unsigned int)((myTM.tm_min*rand()*time(0))/divisor); 00058 } 00059 else Here is the caller graph for this function: RNG::RandomNumberGenerator::ClockRandomSeed 6.11.3.2 main double RNG::RandomNumberGenerator::GetDouble (double minimum_limit, double maximum_limit) Método que retorna um número pseudo-aleatório em ponto flutuante entre minimum_limit e maximum_limit Método que retorna um número entre minimum_limit e maximum_limit ... Definition at line 115 of file RandomNumberGenerator.cxx. 00122 { 00123 //Criando alias para melhorar a legibilidade do programa 00124 double min = minimum_limit; 00125 double max = maximum_limit; 00126 00127 //Verificando se os limites estão corretamente colocados 6.11.3.3 double RNG::RandomNumberGenerator::GetDouble (double maximum_limit) Método que retorna um número pseudo-aleatório em ponto flutuante entre 0.0 e maximum_limit Método que retorna um número entre 0 e maximum_limit ... Definition at line 107 of file RandomNumberGenerator.cxx. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 63. 6.11 RNG::RandomNumberGenerator Class Reference 6.11.3.4 59 double RNG::RandomNumberGenerator::GetDouble (void) Método que retorna um número pseudo-aleatório em ponto flutuante entre 0 e 0.99999 ... Método que retorna um número entre 0 e 0.99999 ... Definition at line 99 of file RandomNumberGenerator.cxx. Here is the caller graph for this function: RNG::Distribution::Bernoulli RNG::Distribution::Binomial RNG::Distribution::Equilikely RNG::Distribution::Erlang RNG::Distribution::Exponential RNG::Distribution::Poisson RNG::Distribution::Geometric RNG::Distribution::Pascal RNG::Distribution::Normal RNG::Distribution::Chisquare main RNG::RandomNumberGenerator::GetDouble RNG::RandomNumberGenerator::Random RNG::Distribution::Student RNG::Distribution::Uniform RNG::Distribution::Lognormal 6.11.3.5 unsigned int RNG::RandomNumberGenerator::GetInt (unsigned int minimum_limit, unsigned int maximum_limit) Método que retorna um número pseudo-aleatóro em formato inteiro sem sinal entre minimum_limit e maximum_limit Metodo que retorna um número entre minimum_limit e maximum_limit Definition at line 82 of file RandomNumberGenerator.cxx. 00089 { 00090 //Criando alias para melhorar a legibilidade do programa 00091 int min = minimum_limit; 00092 int max = maximum_limit; 00093 00094 //Verificando se os limites estão corretamente colocados 6.11.3.6 unsigned int RNG::RandomNumberGenerator::GetInt (unsigned int maximum_limit) Método que retorna um número pseudo-aleatório em formato inteiro sem sinal entre 0 e maximum_limit Metodo que retorna um número entre 0 e maximum_limit Definition at line 74 of file RandomNumberGenerator.cxx. 00074 00075 6.11.3.7 { return rand(); } unsigned int RNG::RandomNumberGenerator::GetInt (void) Metodo que retorna um numero pseudo-aleatorio em formato inteiro sem sinal entre 0 e 32767. Metodo que retorna um número gerado pseudo-aleatoriamente Definition at line 69 of file RandomNumberGenerator.cxx. Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 64. 60 Class Documentation 00069 { return _seed; 6.11.3.8 } void RNG::RandomNumberGenerator::InitSeed (unsigned int seed = 0) Metodo que executa atribuicao inicial na semente interna de geracao de numeros aleatorios. Caso essa semente nao seja modificada entre a geracao de sequencias numericas entao os mesmos numero serao retornados. Método que inicia a semente de geração de número aleatórios Definition at line 24 of file RandomNumberGenerator.cxx. 00024 00025 { _seed = time(0); } Here is the caller graph for this function: main RNG::RandomNumberGenerator::InitSeed RNG::RandomNumberGenerator::RandomNumberGenerator 6.11.3.9 double RNG::RandomNumberGenerator::Random (void) [inline] Apenas um alias para o método GetDouble. Dessa forma podemos interpretar o método como um gerador de números pseudo-aleatórios que retorna elementos uniformemente distribuídos no intervalo aberto (0.0 , 1.0) Definition at line 92 of file RandomNumberGenerator.h. 00092 { return GetDouble(); } Here is the call graph for this function: RNG::RandomNumberGenerator::Random RNG::RandomNumberGenerator::GetDouble Here is the caller graph for this function: RNG::Distribution::Bernoulli RNG::Distribution::Binomial RNG::Distribution::Equilikely RNG::Distribution::Erlang RNG::Distribution::Exponential RNG::Distribution::Poisson RNG::Distribution::Geometric RNG::Distribution::Pascal RNG::Distribution::Normal RNG::Distribution::Chisquare RNG::RandomNumberGenerator::Random RNG::Distribution::Student RNG::Distribution::Uniform RNG::Distribution::Lognormal Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 65. 6.11 RNG::RandomNumberGenerator Class Reference 6.11.3.10 unsigned int RNG::RandomNumberGenerator::Seed (void) Método que retorna a semente de geração de numeros aleatorios armazenada na variavel de estado. Método que retorna o valor da semente armazenada na variavel de estado Definition at line 64 of file RandomNumberGenerator.cxx. The documentation for this class was generated from the following files: • RandomNumberGenerator.h • RandomNumberGenerator.cxx Generated on Sun Dec 4 13:06:32 2011 by Doxygen 61
  • 66. 62 Class Documentation Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 67. Chapter 7 File Documentation 7.1 RandomNumberGenerator.cxx File Reference #include "RandomNumberGenerator.h" #include <ctime> #include <cmath> #include <cstdlib> Include dependency graph for RandomNumberGenerator.cxx: RandomNumberGenerator.cxx ctime cmath cstdlib This graph shows which files directly or indirectly include this file: RandomNumberGenerator.cxx Namespaces • namespace RNG
  • 68. 64 7.2 00001 00002 00003 00004 00005 00006 00007 00008 00009 00013 00014 00015 00016 00017 00018 00019 00020 00024 00025 00029 00030 00031 00032 00033 00034 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00069 00070 00074 00075 00079 00080 00081 00082 00083 00087 00088 File Documentation RandomNumberGenerator.cxx /* * RandomNumberGenerator.cxx * * Created on: 21/10/2009 Author: Michel Alves dos Santos * */ #include "RandomNumberGenerator.h" namespace RNG { //----------------------------------------------------------------------------// // Implementação dos métodos da classe RandomNumberGenerator baseada na função // rand() da biblioteca padrão que usa o método Linear Congruential Generator //----------------------------------------------------------------------------// RandomNumberGenerator::RandomNumberGenerator() { _seed = time(0); } void RandomNumberGenerator::InitSeed(unsigned int seed) { _seed = (seed)?(seed):((unsigned)(time(NULL))); srand( _seed ); } unsigned int RandomNumberGenerator::ClockRandomSeed(unsigned int myseed) { /*Estrutura responsavel pelo armazenamento do horario local*/ /*utilizado na geracao da semente randômica*/ struct tm myTM; double divisor = 1; //Semente baseada no tempo é sugerida se a fornecida for nula if (myseed == 0) return (time(0)*rand()); /*Caso a semente inicial fornecida seja nula então usaremos a estrutura de*/ /*tempo local para geração da semente*/ mktime(&myTM); /*Se a semente fornecida não for nula entao uma semente baseada no algoritmo *de divisao abaixo é fornecida*/ if ((myseed%2) == 0) { divisor = myseed + 0.13579; return (unsigned int)((myTM.tm_min*rand()*time(0))/divisor); } else { divisor = myseed + 0.02468; return (unsigned int)((myTM.tm_min*rand()*time(0))/(divisor/2)); } } unsigned int RandomNumberGenerator::Seed(void) { return _seed; } unsigned int RandomNumberGenerator::GetInt(void){ return rand(); } unsigned int RNG::RandomNumberGenerator::GetInt(unsigned int maximum_limit) { return (int)(maximum_limit*rand()/(RAND_MAX + 1.0)); } unsigned int RNG::RandomNumberGenerator::GetInt(unsigned int minimum_limit, unsigned int maximum_limi t) Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 69. 7.2 RandomNumberGenerator.cxx 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00104 00105 00106 00107 00108 00112 00113 00114 00115 00116 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00168 00169 00170 00174 00175 00176 65 { //Criando alias para melhorar a legibilidade do programa int min = minimum_limit; int max = maximum_limit; //Verificando se os limites estão corretamente colocados if (min > max) RNG::swap(min,max); //Retornando um número gerado dentro dos limites impostos return (int)((max - min + 1)*rand()/(RAND_MAX + 1.0)) + min; } double RNG::RandomNumberGenerator::GetDouble(void) { return rand()/(double(RAND_MAX) + 1); } double RNG::RandomNumberGenerator::GetDouble(double maximum_limit) { return this->GetDouble()*maximum_limit; } double RNG::RandomNumberGenerator::GetDouble(double minimum_limit, double maximum_limit) { //Criando alias para melhorar a legibilidade do programa double min = minimum_limit; double max = maximum_limit; //Verificando se os limites estão corretamente colocados if (min > max) RNG::swap(min,max); //Retornando um número gerado dentro dos limites impostos return GetDouble()*(max - min) + min; } RandomNumberGenerator::~RandomNumberGenerator() {} //----------------------------------------------------------------------------// // Classe para geração de números pseudo-aleatórios que tem como principal // algoritmo o ’Mersenne Twister Pseudo-random Number Generator’ que possui // periodicidade de 2^19937-1. //----------------------------------------------------------------------------// // Inicializando os membros estáticos privados unsigned long MersenneTwisterInt32::state[n] = {0x0UL}; int MersenneTwisterInt32::p = 0; bool MersenneTwisterInt32::init = false; inline void MersenneTwisterInt32::gen_state() { for (int i = 0; i < (n - m); ++i) state[i] = state[i + m] ^ twiddle(state[i], state[i + 1]); for (int i = n - m; i < (n - 1); ++i) state[i] = state[i + m - n] ^ twiddle(state[i], state[i + 1]); state[n - 1] = state[m - 1] ^ twiddle(state[n - 1], state[0]); p = 0; // reinicia a posicao } MersenneTwisterInt32::MersenneTwisterInt32() { if (!init) Seed(5489UL); init = true; }; MersenneTwisterInt32::MersenneTwisterInt32(unsigned long { Seed(seed); init = true; Generated on Sun Dec 4 13:06:32 2011 by Doxygen seed)
  • 70. 66 00177 00178 00183 00184 00185 00186 00187 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00244 00245 00246 File Documentation } MersenneTwisterInt32::MersenneTwisterInt32(const unsigned long *array, int size) { Seed(array, size); init = true; } void MersenneTwisterInt32::Seed(unsigned long { // Para máquinas com mais de 32 bits state[0] = seed & 0xFFFFFFFFUL; seed) // Looping que obtem a nova semente para geração de números for (int i = 1; i < n; ++i) { state[i] = 1812433253UL * (state[i - 1] ^ (state[i - 1] >> 30)) + i; state[i] &= 0xFFFFFFFFUL; // Para máquinas com mais de 32 bits } // Força gen_state() a ser chamada para um novo número aleatório p = n; } void MersenneTwisterInt32::Seed(const unsigned long* array, int size) { Seed(19650218UL); int i = 1, j = 0; for (int k = ((n > size) ? n : size); k; --k) { state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525UL)) + array[j] + j; // non linear state[i] &= 0xFFFFFFFFUL; // Para máquinas com mais de 32 bits ++j; j %= size; if ((++i) == n) { state[0] = state[n - 1]; i = 1; } } for (int k = n - 1; k; --k) { state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941UL)) - i; state[i] &= 0xFFFFFFFFUL; // Para máquinas com mais de 32 bits if ((++i) == n) { state[0] = state[n - 1]; i = 1; } } // O estado zero recebe 1 - assumindo um inicio de array não-nulo state[0] = 0x80000000UL; // Força gen_state() a ser chamada para um novo número aleatório p = n; } unsigned long MersenneTwisterInt32::twiddle(unsigned long u, unsigned long v) { return (((u & 0x80000000UL) | (v & 0x7FFFFFFFUL)) >> 1)^ ((v & 1UL) ? 0x9908B0D FUL : 0x0UL); 00247 } 00248 00252 unsigned long MersenneTwisterInt32::rand_int32() 00253 { 00254 //Caso seja necessario um novo estado para o vetor de estados 00255 if (p == n) gen_state(); 00256 00257 //O método gen_state() é dividido para ser inline, porque ele só é 00258 //chamado uma vez a cada 624 chamadas de outro modo ele se tornaria muito Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 71. 7.2 RandomNumberGenerator.cxx 00259 00260 00261 00262 00263 00264 00265 00266 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00311 00312 00313 00314 00315 00316 00320 00321 00322 00323 00324 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 67 //grande para ser implementado como método inline. unsigned long x = state[p++]; x ^= (x >> 11); x ^= (x << 7) & 0x9D2C5680UL; x ^= (x << 15) & 0xEFC60000UL; return x ^ (x >> 18); } MersenneTwisterInt32::~MersenneTwisterInt32(){}; //----------------------------------------------------------------------------// // Classes para geração de números pseudo-aleatórios que tem como principal // algoritmo o ’R250’ que possui periodicidade de 2^250-1. //----------------------------------------------------------------------------// // Inicializando os membros estáticos da classe int R250Base::r250_index = 0; unsigned long R250Base::seed = 1; unsigned int R250Base::r250_buffer[250] = { 15301,57764,10921,56345,19316,43154,54727,49252,32360,49582, 26124,25833,34404,11030,26232,13965,16051,63635,55860,5184, 15931,39782,16845,11371,38624,10328,9139,1684,48668,59388, 13297,1364,56028,15687,63279,27771,5277,44628,31973,46977, 16327,23408,36065,52272,33610,61549,58364,3472,21367,56357, 56345,54035,7712,55884,39774,10241,50164,47995,1718,46887, 47892,6010,29575,54972,30458,21966,54449,10387,4492,644, 57031,41607,61820,54588,40849,54052,59875,43128,50370,44691, 286,12071,3574,61384,15592,45677,9711,23022,35256,45493, 48913,146,9053,5881,36635,43280,53464,8529,34344,64955, 38266,12730,101,16208,12607,58921,22036,8221,31337,11984, 20290,26734,19552,48,31940,43448,34762,53344,60664,12809, 57318,17436,44730,19375,30,17425,14117,5416,23853,55783, 57995,32074,26526,2192,11447,11,53446,35152,64610,64883, 26899,25357,7667,3577,39414,51161,4,58427,57342,58557, 53233,1066,29237,36808,19370,17493,37568,3,61468,38876, 17586,64937,21716,56472,58160,44955,55221,63880,1,32200, 62066,22911,24090,10438,40783,36364,14999,2489,43284,9898, 39612,9245,593,34857,41054,30162,65497,53340,27209,45417, 37497,4612,58397,52910,56313,62716,22377,40310,15190,34471, 64005,18090,11326,50839,62901,59284,5580,15231,9467,13161, 58500,7259,317,50968,2962,23006,32280,6994,18751,5148, 52739,49370,51892,18552,52264,54031,2804,17360,1919,19639, 2323,9448,43821,11022,45500,31509,49180,35598,38883,19754, 987,11521,55494,38056,20664,2629,50986,31009,54043,59743 }; inline unsigned R250Base::myrand() { seed = seed*0x015a4e35L + 1; return (seed>>16)&0x7fff; } inline void R250Base::mysrand(unsigned newseed) { seed = newseed; } void R250Base::r250_init(unsigned long seed) { int j, k; unsigned int mask; unsigned int msb; mysrand(seed); r250_index = 0; for (j = 0; j < 250; j++) Generated on Sun Dec 4 13:06:32 2011 by Doxygen /* Fill the r250 buffer with 15-bit values */
  • 72. 68 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00419 File Documentation r250_buffer[j] = myrand(); for (j = 0; j < 250; j++) /* Set some of the MS bits to 1 */ if (myrand() > 16384) r250_buffer[j] |= 0x8000; msb = 0x8000; mask = 0xffff; /* To turn on the diagonal bit */ /* To turn off the leftmost bits */ for (j = 0; j < 16; j++) { k = 11 * j + 3; r250_buffer[k] &= mask; r250_buffer[k] |= msb; mask >>= 1; msb >>= 1; } /* Select a word to operate on */ /* Turn off bits left of the diagonal */ /* Turn on the diagonal bit */ } unsigned int R250Int::operator ()() { register int j; register unsigned int new_rand; // Verifica limites de salto - Wrap pointer around if (r250_index >= 147) j = r250_index - 147; else j = r250_index + 103; new_rand = r250_buffer[r250_index] ^= r250_buffer[j]; //Incrementa o ponteiro para o próximo salto dentro do vetor de sementes if (r250_index >= 249) r250_index = 0; else r250_index++; return new_rand; } unsigned int R250Int::operator ()(unsigned int maximum_limit) { register int j; register unsigned int new_rand, limit; unsigned int n = maximum_limit; // LImitede geração de números limit = (65535U/n)*n; do { //Usando o operador que retorna numeros entre 0 e 65535 new_rand = operator ()(); // Verifica limites de salto - Wrap pointer around if (r250_index >= 147) j = r250_index - 147; else j = r250_index + 103; new_rand = r250_buffer[r250_index] ^= r250_buffer[j]; //Incrementa o ponteiro para o próximo salto dentro do vetor de sementes if (r250_index >= 249) r250_index = 0; else r250_index++; } while(new_rand >= limit); // Retorno da função ... return new_rand%n; } double R250Double::operator ()() Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 73. 7.2 RandomNumberGenerator.cxx 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00446 00447 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00494 00495 00500 00501 00502 00503 00504 00509 00510 00511 00512 00513 69 { register int j; register unsigned int new_rand; // Verifica limites de salto - Wrap pointer around if (r250_index >= 147) j = r250_index - 147; else j = r250_index + 103; new_rand = r250_buffer[r250_index] ^= r250_buffer[j]; //Incrementa o ponteiro para o próximo salto dentro do vetor de sementes if (r250_index >= 249) r250_index = 0; else r250_index++; return new_rand / 65536.; // Retorna um numero entre [0.0 até 1.0) } //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// double BoxMuller::operator ()(double Mean, double StandardDev) { float x1, x2, w, y1; static float y2; static bool use_last = false; //Verifica se o valor usado deve ser o da última chamada if (use_last) { y1 = y2; use_last = false; } else { //Calculo da localização do número dentro do intervalo passado do { x1 = 2.0 * GetDouble() - 1.0; x2 = 2.0 * GetDouble() - 1.0; w = x1 * x1 + x2 * x2; } while ( w >= 1.0 ); w = sqrt( (-2.0 * log( w ) ) / w ); y1 = x1 * w; y2 = x2 * w; use_last = true; } //Retorno do número transformado ... return( Mean + y1 * StandardDev ); } //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// long Distribution::Bernoulli(double probability) { return ((Random() < (1.0 - probability)) ? 0 : 1); } long Distribution::Binomial (unsigned long limit_experiment, double probability) { unsigned long i, x = 0; for (i = 0; i < limit_experiment; i++) x += Bernoulli(probability); return (x); Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 74. 70 00514 00515 00520 00521 00522 00523 00524 00525 00530 00531 00532 00533 00534 00539 00540 00541 00542 00543 00544 00545 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00568 00569 00570 00571 00572 00573 00578 00579 00580 00581 00582 00587 00588 00589 00590 00591 00592 00593 00594 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 File Documentation } long Distribution::Equilikely (long a, long b) { if (a > b) swap(a,b); // Verificando se o intervalo foi fornecido corretamente return (a + (long)((b - a + 1) * Random())); } unsigned long Distribution::Geometric(double probability) { return ((long) (log(1.0 - Random()) / log(probability))); } long Distribution::Pascal(unsigned long limit_experiment, double probability) { unsigned long i, x = 0; for (i = 0; i < limit_experiment; i++) x += Geometric(probability); return (x); } long Distribution::Poisson(double mean) { double t = 0.0; long x = 0; while (t < mean) { t += Exponential(1.0); x++; } return (x - 1); } double Distribution::Uniform(double a, double b) { if (a > b) swap(a,b); return (a + (b - a) * Random()); } double Distribution::Exponential(double mean) { return (-mean * log(1.0 - Random())); } double Distribution::Erlang(long limit_experiment, double base) { long i; double x = 0.0; for (i = 0; i < limit_experiment; i++) x += Exponential(base); return (x); } double Distribution::Normal(double Mean, double StandarDev) { const double p0 = 0.322232431088; const double q0 = 0.099348462606; const double p1 = 1.0; const double q1 = 0.588581570495; const double p2 = 0.342242088547; const double q2 = 0.531103462366; const double p3 = 0.204231210245e-1; const double q3 = 0.103537752850; const double p4 = 0.453642210148e-4; const double q4 = 0.385607006340e-2; double u, t, p, q, z; u = Random(); if (u < 0.5) t = sqrt(-2.0 * log(u)); else t = sqrt(-2.0 * log(1.0 - u)); Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 75. 7.2 RandomNumberGenerator.cxx 00613 00614 00615 00616 00617 00618 00619 00620 00621 00626 00627 00628 00629 00630 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00653 00654 00655 00656 00657 00658 p q = p0 + t * (p1 + t * (p2 + t * (p3 + t * p4))); = q0 + t * (q1 + t * (q2 + t * (q3 + t * q4))); if (u < 0.5) z = (p / q) - t; else z = t - (p / q); return (Mean + StandarDev * z); } double Distribution::Lognormal(double a, double b) { return (exp(a + b * Normal(0.0, 1.0))); } double Distribution::Chisquare(unsigned long limit_experiment) { unsigned long i; double z, x = 0.0; for (i = 0; i < limit_experiment; i++) { z = Normal(0.0, 1.0); x += z * z; } return (x); } double Distribution::Student(unsigned long limit_experiment) { return (Normal(0.0, 1.0)/sqrt(Chisquare(limit_experiment)/limit_experiment)); } }; //Fim do namespace RNG Generated on Sun Dec 4 13:06:32 2011 by Doxygen 71
  • 76. 72 File Documentation 7.3 RandomNumberGenerator.h File Reference #include <ctime> #include <cmath> #include <cstdlib> Include dependency graph for RandomNumberGenerator.h: RandomNumberGenerator.h ctime cmath cstdlib This graph shows which files directly or indirectly include this file: RandomNumberGenerator.h Sys-LibraryRandom.cpp Classes • • • • • • • • • • • class RNG::RandomNumberGenerator class RNG::MersenneTwisterInt32 class RNG::MersenneTwisterDouble class RNG::MersenneTwisterDoubleClosed class RNG::MersenneTwisterDoubleOpened class RNG::MersenneTwisterDouble53 class RNG::R250Base class RNG::R250Int class RNG::R250Double class RNG::BoxMuller class RNG::Distribution Namespaces • namespace RNG Functions • template<typename T > void RNG::swap (T &a, T &b) Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 77. 7.4 RandomNumberGenerator.h 7.4 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00020 00021 00022 00029 00030 00031 00032 00033 00037 00038 00042 00043 00049 00050 00055 00056 00061 00062 00067 00068 00073 00074 00079 00080 00085 00086 00092 00093 00098 00099 00104 00105 00110 00111 00112 00113 00121 00122 00123 00124 00125 00126 00127 00131 00132 00136 00137 00141 00142 00143 00144 73 RandomNumberGenerator.h /* * RandomNumberGenerator.h * * Created on: 21/10/2009 Author: Michel Alves dos Santos * */ #ifndef RANDOMNUMBERGENERATOR_H_ #define RANDOMNUMBERGENERATOR_H_ #include <ctime> #include <cmath> #include <cstdlib> namespace RNG { class RandomNumberGenerator { unsigned int _seed; /*Armazena a semente de geração de números aleatórios*/ public: RandomNumberGenerator(); RandomNumberGenerator(unsigned long seed) { InitSeed(seed); }; void InitSeed(unsigned int seed = 0); unsigned int ClockRandomSeed(unsigned int myseed = 0); unsigned int Seed(void); unsigned int GetInt(void); unsigned int GetInt(unsigned int maximum_limit); unsigned int GetInt(unsigned int minimum_limit, unsigned int maximum_limit); double GetDouble(void); double Random(void) { return GetDouble(); } double GetDouble(double maximum_limit); double GetDouble(double minimum_limit, double maximum_limit); virtual ~RandomNumberGenerator(); }; class MersenneTwisterInt32 { static const int n = 624, m = 397; static unsigned long state[n]; static int p; static bool init; // // // // constantes em tempo de compilacao Estado do vetor posição dentro do vetor de estados true se a função init foi invocada unsigned long twiddle(unsigned long u, unsigned long v); void gen_state(); MersenneTwisterInt32(const MersenneTwisterInt32&); // Construtor de cópia void operator=(const MersenneTwisterInt32&); // Operador de atribuição protected: Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 78. 74 00145 00149 00150 00151 00152 00156 00157 00161 00162 00170 00171 00175 00176 00180 00181 00186 00187 00192 00193 00194 00195 00203 00204 00205 00206 00210 00211 00215 00216 00221 00222 00223 00228 00229 00230 00235 00236 00237 00238 00242 00243 00247 00248 00249 00250 00258 00259 00260 00264 00265 00269 00270 00271 00276 00277 00278 00283 00284 File Documentation unsigned long rand_int32(); public: MersenneTwisterInt32(); MersenneTwisterInt32(unsigned long seed); MersenneTwisterInt32(const unsigned long* array, int size); void Seed(unsigned long seed); void Seed(const unsigned long* array, int size); unsigned long operator()() { return rand_int32(); } virtual ~MersenneTwisterInt32(); }; class MersenneTwisterDouble : public MersenneTwisterInt32 { public: MersenneTwisterDouble() : MersenneTwisterInt32() {}; MersenneTwisterDouble(unsigned long seed) : MersenneTwisterInt32(seed) {}; MersenneTwisterDouble(const unsigned long* seed, int size) : MersenneTwisterInt32(seed, size) {}; double operator()() { return static_cast<double>(rand_int32()) * (1. / 4294967296.); } // divisão p or 2^32 ~MersenneTwisterDouble() {}; private: MersenneTwisterDouble(const MersenneTwisterDouble&); void operator=(const MersenneTwisterDouble&); }; class MersenneTwisterDoubleClosed : public MersenneTwisterInt32 { public: MersenneTwisterDoubleClosed() : MersenneTwisterInt32() {}; MersenneTwisterDoubleClosed(unsigned long seed) : MersenneTwisterInt32(seed) {}; MersenneTwisterDoubleClosed(const unsigned long* seed, int size) : MersenneTwisterInt32(seed, size) {}; double operator()() { return static_cast<double>(rand_int32()) * (1. / 4294967295.); } // divisão p or 2^32 - 1 00285 00290 ~MersenneTwisterDoubleClosed() {}; 00291 00292 private: 00293 00297 MersenneTwisterDoubleClosed(const MersenneTwisterDoubleClosed&); 00298 Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 79. 7.4 RandomNumberGenerator.h 00302 00303 00304 00305 00313 00314 00315 00316 00320 00321 00325 00326 00327 00332 00333 00334 00339 00340 00341 00346 00347 00348 00349 00353 00354 00358 00359 00360 00361 00369 00370 00371 00372 00376 00377 00381 00382 00387 00388 00389 00394 00395 00396 00397 75 void operator=(const MersenneTwisterDoubleClosed&); }; class MersenneTwisterDoubleOpened : public MersenneTwisterInt32 { public: MersenneTwisterDoubleOpened() : MersenneTwisterInt32() {}; MersenneTwisterDoubleOpened(unsigned long seed) : MersenneTwisterInt32(seed) {}; MersenneTwisterDoubleOpened(const unsigned long* seed, int size) : MersenneTwisterInt32(seed, size) {}; double operator()() { return (static_cast<double>(rand_int32()) + .5) * (1. / 4294967296.); } // di visão por 2^32 ~MersenneTwisterDoubleOpened() {}; private: MersenneTwisterDoubleOpened(const MersenneTwisterDoubleOpened&); void operator=(const MersenneTwisterDoubleOpened&); }; class MersenneTwisterDouble53 : public MersenneTwisterInt32 { public: MersenneTwisterDouble53() : MersenneTwisterInt32() {}; MersenneTwisterDouble53(unsigned long seed) : MersenneTwisterInt32(seed) {}; MersenneTwisterDouble53(const unsigned long* seed, int size) : MersenneTwisterInt32(seed, size) {}; double operator()() { return (static_cast<double>(rand_int32() >> 5) * 67108864. + static_cast<double>(rand_int32() >> 6)) * (1. / 9007199254740992. ); 00398 00399 00404 00405 00406 00407 00411 00412 00416 00417 00418 00419 00425 00426 00427 00428 00429 00430 00431 00435 00436 } ~MersenneTwisterDouble53() {}; private: MersenneTwisterDouble53(const MersenneTwisterDouble53&); void operator=(const MersenneTwisterDouble53&); }; class R250Base { public: static int r250_index; static unsigned int r250_buffer[250]; static unsigned long seed; R250Base() {}; Generated on Sun Dec 4 13:06:32 2011 by Doxygen // Controla o índice da semente // Array de sementes de randomização // Semente unidimensional
  • 80. 76 00440 00441 00448 00449 00454 00455 00459 00460 00461 00462 00469 00470 00471 00472 00476 00477 00481 00482 00489 00490 00497 00498 00499 00506 00507 00508 00512 00513 00517 00518 00524 00525 00526 00535 00536 00537 00538 00542 00543 00547 00548 00555 00556 00557 00590 00591 00592 00593 00597 00598 00602 00603 00610 00611 00616 00617 00622 00623 00628 00629 00634 00635 00640 00641 00646 00647 00652 File Documentation R250Base(unsigned long seed) { r250_init(seed); } static unsigned myrand(); static void mysrand(unsigned newseed); void r250_init(unsigned long seed); }; class R250Int : public R250Base { public: R250Int() : R250Base() {}; R250Int(unsigned long seed) : R250Base(seed) {}; unsigned int operator()(); unsigned int operator()(unsigned int maximum_limit); }; class R250Double : public R250Base { public: R250Double() : R250Base() {}; R250Double(unsigned long seed) : R250Base(seed) {}; double operator()(); }; class BoxMuller : public RandomNumberGenerator { public : BoxMuller() : RandomNumberGenerator() {}; BoxMuller(unsigned long seed) : RandomNumberGenerator(seed) {}; double operator()(double Mean, double StandardDev); }; class Distribution : public RandomNumberGenerator { public : Distribution () : RandomNumberGenerator() {}; Distribution(unsigned long seed) : RandomNumberGenerator(seed) {}; long Bernoulli (double probability = 0.5); long Binomial (unsigned long limit_experiment, double probability = 0.5); long Equilikely (long a, long b); unsigned long Geometric(double probability = 0.5); long Pascal(unsigned long limit_experiment, double probability = 0.5); long Poisson(double mean); double Uniform(double a, double b); double Exponential(double mean = 0.5); Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 81. 7.4 RandomNumberGenerator.h 00653 00658 00659 00664 00665 00670 00671 00676 00677 00682 00683 00684 00685 00686 00687 00688 77 double Erlang(long limit_experiment, double base); double Normal(double Mean, double StandarDev); double Lognormal(double a, double b); double Chisquare(unsigned long limit_experiment); double Student(unsigned long limit_experiment); }; /*Função utilitária que executa a troca entre dois valores */ template <typename T> void swap(T& a, T& b) { T temp(a); a = b; } #endif /* RANDOMNUMBERGENERATOR_H_ */ Generated on Sun Dec 4 13:06:32 2011 by Doxygen b = temp; };
  • 82. 78 File Documentation 7.5 Sys-LibraryRandom.cpp File Reference #include <iostream> #include "RandomNumberGenerator.h" Include dependency graph for Sys-LibraryRandom.cpp: Sys-LibraryRandom.cpp iostream RandomNumberGenerator.h ctime cmath cstdlib Functions • int main (int argc, char ∗argv[ ]) 7.5.1 Function Documentation 7.5.1.1 int main (int argc, char ∗ argv[ ]) Função para testes com a biblioteca. Definition at line 13 of file Sys-LibraryRandom.cpp. 00014 { 00015 //Declarando um objeto 00016 RNG::RandomNumberGenerator rng; 00017 00018 //Estabelecendo uma semente. 00019 rng.InitSeed(rng.ClockRandomSeed()); 00020 00021 //Executando método para obtençao de números aleatórios 00022 std::cout << "[Números Aleatórios entre 0 e 1]" << std::endl; 00023 for(int i = 0; i < 5; ++i) std::cout << rng.GetDouble() << "t"; 00024 00025 //Retorno da função de teste 00026 return 0; 00027 } Here is the call graph for this function: RNG::RandomNumberGenerator::ClockRandomSeed main RNG::RandomNumberGenerator::GetDouble RNG::RandomNumberGenerator::InitSeed Generated on Sun Dec 4 13:06:32 2011 by Doxygen
  • 83. 7.6 Sys-LibraryRandom.cpp 7.6 00001 00002 00003 00004 00005 00006 00007 00008 00009 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 Sys-LibraryRandom.cpp //============================================================================ // Name : LibraryRandom // Author : Michel Alves dos Santos // Version : 1.0 beta //============================================================================ #include <iostream> #include "RandomNumberGenerator.h" int main(int argc, char* argv[]) { //Declarando um objeto RNG::RandomNumberGenerator rng; //Estabelecendo uma semente. rng.InitSeed(rng.ClockRandomSeed()); //Executando método para obtençao de números aleatórios std::cout << "[Números Aleatórios entre 0 e 1]" << std::endl; for(int i = 0; i < 5; ++i) std::cout << rng.GetDouble() << "t"; //Retorno da função de teste return 0; } Generated on Sun Dec 4 13:06:32 2011 by Doxygen 79
  • 84. Index ∼MersenneTwisterDouble RNG::MersenneTwisterDouble, 27 ∼MersenneTwisterDouble53 RNG::MersenneTwisterDouble53, 31 ∼MersenneTwisterDoubleClosed RNG::MersenneTwisterDoubleClosed, 35 ∼MersenneTwisterDoubleOpened RNG::MersenneTwisterDoubleOpened, 39 ∼MersenneTwisterInt32 RNG::MersenneTwisterInt32, 42 ∼RandomNumberGenerator RNG::RandomNumberGenerator, 57 Bernoulli RNG::Distribution, 18 Binomial RNG::Distribution, 19 BoxMuller RNG::BoxMuller, 14 Chisquare RNG::Distribution, 19 ClockRandomSeed RNG::RandomNumberGenerator, 57 Distribution RNG::Distribution, 18 Equilikely RNG::Distribution, 20 Erlang RNG::Distribution, 20 Exponential RNG::Distribution, 20 Geometric RNG::Distribution, 21 GetDouble RNG::RandomNumberGenerator, 58 GetInt RNG::RandomNumberGenerator, 59 InitSeed RNG::RandomNumberGenerator, 60 Lognormal RNG::Distribution, 21 main Sys-LibraryRandom.cpp, 78 MersenneTwisterDouble RNG::MersenneTwisterDouble, 27 MersenneTwisterDouble53 RNG::MersenneTwisterDouble53, 31 MersenneTwisterDoubleClosed RNG::MersenneTwisterDoubleClosed, 35 MersenneTwisterDoubleOpened RNG::MersenneTwisterDoubleOpened, 39 MersenneTwisterInt32 RNG::MersenneTwisterInt32, 42 myrand RNG::R250Base, 46 mysrand RNG::R250Base, 46 Normal RNG::Distribution, 21 operator() RNG::BoxMuller, 14 RNG::MersenneTwisterDouble, 27 RNG::MersenneTwisterDouble53, 31 RNG::MersenneTwisterDoubleClosed, 35 RNG::MersenneTwisterDoubleOpened, 39 RNG::MersenneTwisterInt32, 42 RNG::R250Double, 51 RNG::R250Int, 54 Pascal RNG::Distribution, 22 Poisson RNG::Distribution, 22 r250_buffer RNG::R250Base, 47 r250_index RNG::R250Base, 48 r250_init RNG::R250Base, 46 R250Base RNG::R250Base, 46 R250Double
  • 85. INDEX RNG::R250Double, 51 R250Int RNG::R250Int, 54 rand_int32 RNG::MersenneTwisterInt32, 43 Random RNG::RandomNumberGenerator, 60 RandomNumberGenerator RNG::RandomNumberGenerator, 57 RandomNumberGenerator.cxx, 63 RandomNumberGenerator.h, 72 RNG, 9 swap, 9 RNG::BoxMuller, 11 BoxMuller, 14 operator(), 14 RNG::Distribution, 16 Bernoulli, 18 Binomial, 19 Chisquare, 19 Distribution, 18 Equilikely, 20 Erlang, 20 Exponential, 20 Geometric, 21 Lognormal, 21 Normal, 21 Pascal, 22 Poisson, 22 Student, 23 Uniform, 23 RNG::MersenneTwisterDouble, 25 ∼MersenneTwisterDouble, 27 MersenneTwisterDouble, 27 operator(), 27 RNG::MersenneTwisterDouble53, 29 ∼MersenneTwisterDouble53, 31 MersenneTwisterDouble53, 31 operator(), 31 RNG::MersenneTwisterDoubleClosed, 33 ∼MersenneTwisterDoubleClosed, 35 MersenneTwisterDoubleClosed, 35 operator(), 35 RNG::MersenneTwisterDoubleOpened, 37 ∼MersenneTwisterDoubleOpened, 39 MersenneTwisterDoubleOpened, 39 operator(), 39 RNG::MersenneTwisterInt32, 41 ∼MersenneTwisterInt32, 42 MersenneTwisterInt32, 42 operator(), 42 rand_int32, 43 Seed, 43, 44 RNG::R250Base, 45 Generated on Sun Dec 4 13:06:32 2011 by Doxygen 81 myrand, 46 mysrand, 46 r250_buffer, 47 r250_index, 48 r250_init, 46 R250Base, 46 seed, 48 RNG::R250Double, 49 operator(), 51 R250Double, 51 RNG::R250Int, 52 operator(), 54 R250Int, 54 RNG::RandomNumberGenerator, 56 ∼RandomNumberGenerator, 57 ClockRandomSeed, 57 GetDouble, 58 GetInt, 59 InitSeed, 60 Random, 60 RandomNumberGenerator, 57 Seed, 60 Seed RNG::MersenneTwisterInt32, 43, 44 RNG::RandomNumberGenerator, 60 seed RNG::R250Base, 48 Student RNG::Distribution, 23 swap RNG, 9 Sys-LibraryRandom.cpp, 78 main, 78 Uniform RNG::Distribution, 23