hfnran(3f) - [M_datapac:RANDOM] generate half-normal random numbers
Synopsis
Description
Input Arguments
Output Arguments
Examples
Author
Maintainer
License
References
SUBROUTINE HFNRAN(N,Iseed,X)
INTEGER,intent(in) :: N INTEGER,intent(inout) :: Iseed REAL(kind=wp),intent(out) :: X(:)
HFNRAN(3f) generates a random sample of size n from the halfnormal distribution.The prototype halfnormal distribution used herein has mean = sqrt(2/pi) = 0.79788456 and standard deviation = 1. this distribution is defined for all non-negative X and has the probability density function
f(X) = (2/sqrt(2*pi)) * exp(-X*X/2).The prototype halfnormal distribution used herein is the distribution of the variate X = abs(Z) where the variate Z is normally distributed with mean = 0 and standard deviation = 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 from the halfnormal distribution will be placed.
Sample program:
program demo_hfnran use M_datapac, only : hfnran implicit none ! call hfnran(x,y) end program demo_hfnranResults:
The original DATAPAC library was written by James Filliben of the Statistical Engineering Division, National Institute of Standards and Technology.
John Urban, 2022.05.31
CC0-1.0
o TOCHER, THE ART OF SIMULATION, 1963, pages 14-15. o HAMMERSLEY AND HANDSCOMB, MONTE CARLO METHODS, 1964, page 36. o JOHNSON AND KOTZ, CONTINUOUS UNIVARIATE DISTRIBUTIONS--1, 1970, pages 53, 59, 81, 83.
Nemo Release 3.1 | hfnran (3) | February 23, 2025 |