uniran(3f) - [M_datapac:RANDOM] generate Uniform random numbers
Synopsis
Description
Input Arguments
Output Arguments
Examples
Author
Written By
Maintainer
License
References
SUBROUTINE UNIRAN(N,Iseed,X)
INTEGER,intent(in) :: N INTEGER,intent(inout) :: Iseed REAL(kind=wp),intent(out) :: X(:)
UNIRAN(3f) generates a random sample of size N from the uniform (rectangular) distribution on the unit interval (0,1).This distribution has mean = 0.5 and standard deviation = sqrt(1/12) = 0.28867513. This distribution has the probability density function
f(X) = 1
N The desired integer number of random numbers to be generated. ISEED An integer iseed value. Should be set to a non-negative value to start a new sequence of values. Will be set to -1 on return to indicate the next call should continue the current random sequence walk.
X A vector (of dimension at least N) into which the generated random sample of size N from the rectangular distribution on (0,1) will be placed.
Sample program:
program demo_uniran use M_datapac, only : uniran, plotxt, sort, label implicit none integer,parameter :: n=400 real :: x(n) integer :: iseed call label(uniran) iseed=1234 call UNIRAN(n,Iseed,X) call plotxt(x,n) ! plot random values call sort(x,n,x) ! sort values call plotxt(x,n) ! should display the f(x)=1 nature ! of the distribution end program demo_uniranResults:
THE FOLLOWING IS A PLOT OF X(I) (VERTICALLY) VERSUS I (HORIZONTALLY I-----------I-----------I-----------I-----------I 0.9982013E+00 - X X X X X X X 0.9566447E+00 I X XX X XX XXXX X XX 0.9150882E+00 I X XXXX X XXXX X X X X X XX X X 0.8735316E+00 I XX XXX XX XXXXXX X X X X X 0.8319750E+00 I XXX X X X X X XX X X X 0.7904184E+00 I XXX XX X X X X X XXX 0.7488618E+00 - X XX X X X X X X X X X XXX X 0.7073053E+00 I X X X X X X X X X X X X 0.6657487E+00 I X XXX X XX XXX X X X X X X X 0.6241921E+00 I X X X X XX X X X X 0.5826355E+00 I X X X XX X X X X X 0.5410789E+00 I XX X XX X X XXX XX X X 0.4995224E+00 - X X XX X XXX XX 0.4579658E+00 I XXX X XXX X X X XX XX X X X X 0.4164092E+00 I XX X X X X X X X X X 0.3748527E+00 I XX XX XX X X XX XX XX X X 0.3332961E+00 I X XXX X X X X X XXXX X X 0.2917395E+00 I X X X X X X XX XX XX X 0.2501829E+00 - XX XXX X X X X XX XXXX X 0.2086263E+00 I X X X X X X XX X X XX 0.1670697E+00 I X X X XX X XX XX XXX X X XXX X 0.1255132E+00 I X XXX X X X X XX X 0.8395660E-01 I X X X X XX X X X X X X X XX 0.4240000E-01 I X XX X X X X X X X X X 0.8433913E-03 - X X X X X I-----------I-----------I-----------I-----------I 0.1000E+01 0.1008E+03 0.2005E+03 0.3002E+03 0.4000E+03THE FOLLOWING IS A PLOT OF X(I) (VERTICALLY) VERSUS I (HORIZONTALLY I-----------I-----------I-----------I-----------I 0.9982013E+00 - XX 0.9566447E+00 I XXX 0.9150882E+00 I XXXX 0.8735316E+00 I XXX 0.8319750E+00 I XXX 0.7904184E+00 I XXX 0.7488618E+00 - XXX 0.7073053E+00 I XXX 0.6657487E+00 I XXX 0.6241921E+00 I XX 0.5826355E+00 I XXX 0.5410789E+00 I XXX 0.4995224E+00 - XX 0.4579658E+00 I XXXX 0.4164092E+00 I XX 0.3748527E+00 I XXX 0.3332961E+00 I XXX 0.2917395E+00 I XX 0.2501829E+00 - XXXX 0.2086263E+00 I XX 0.1670697E+00 I XXXX 0.1255132E+00 I XXX 0.8395660E-01 I XXX 0.4240000E-01 I XX 0.8433913E-03 - X I-----------I-----------I-----------I-----------I 0.1000E+01 0.1008E+03 0.2005E+03 0.3002E+03 0.4000E+03
The original DATAPAC library was written by James Filliben of the Statistical Engineering Division, National Institute of Standards and Technology.
o James Blue Scientific Computing Division Center for Applied Mathematics National Bureau of Standards Washington, D. C. 20234
o David Kahaner Scientific Computing Division Center for Applied Mathematics National Bureau of Standards
o George Marsaglia Computer Science Department Washington State University
o James J. Filliben Statistical Engineering Division Center for Applied Mathematics National Bureau of Standards
John Urban, 2022.05.31
CC0-1.0
o Marsaglia G., "Comments on the Perfect Uniform Random Number Generator", Unpublished Notes, Wash S. U. o Johnson and Kotz, Continuous Univariate Distributions--2, 1970, pages 57-74.
Nemo Release 3.1 | uniran (3) | February 23, 2025 |