The following is an example of using blitz ++ to generate a random number.
# Include <Ctime> # Include <Iostream> # Include <Random/uniform. h> // Even distribution # Include <Random/normal. h> // Normal Distribution # Include <Random/exponential. h> // Exponential Distribution # Include <Random/discrete-uniform.h> // Discrete Distribution # Include <Random/beta. h> // Beta distribution # Include <Random/gamma. h> // Gamma distribution # Include <Random/chisquare. h> // X2 Distribution # Include <Random/F. H> // F distribution Using namespace Ranlib ; Using namespace STD ; Int _ Tmain ( Int Argc , _ Tchar * Argv []) { // Continuous and even random distribution [0, 1) Uniform < Double > Run ; Run . Seed (( Unsigned int )Time (0 )); Cout < Run . Random () < Endl ; // Continuous and even random distribution [0, 1] Uniformclosed < Double > Run1 ; Run1 . Seed (( Unsigned int ) Time (0 ));Cout < Run1 . Random () < Endl ; // Continuous and even random distribution (0, 1) Uniformopen < Double > Run2 ; Run2 . Seed (( Unsigned int ) Time (0 )); Cout <Run2 . Random () < Endl ; // Continuous and even random distribution (0, 1] Uniformopenclosed < Double > Run3 ; Run3 . Seed (( Unsigned int ) Time (0 )); Cout < Run3 .Random () < Endl ; // Random number of discrete and even distribution from 1 to 99 Discreteuniform < Long > Rdu (100 ); Rdu . Seed (( Unsigned int ) Time (0 )); Cout < Rdu . Random () <Endl ; // Normal Distribution Normal < Double > Rnor (10, 2 ); Rnor . Seed (( Unsigned int ) Time (0 )); Cout < Rnor . Random () < Endl ;// The beta distribution is faulty. // beta <double> RBA; // cout <RBA. random () <Endl; // cout <numeric_limits <double>: min (); // Exponential Distribution Exponential < Double > Rex (0.5 ); Cout < Rex . Random (); //.. Return 0 ;}