random_binomial2 Function

public function random_binomial2(n, pp, first) result(ival)


 Translated to Fortran 90 by Alan Miller from:
                          RANLIB

 Library of Fortran Routines for Random Number Generation

                  Compiled and Written by:

                       Barry W. Brown
                        James Lovato

           Department of Biomathematics, Box 237
           The University of Texas, M.D. Anderson Cancer Center
           1515 Holcombe Boulevard
           Houston, TX      77030

This work was supported by grant CA-16672 from the National Cancer Institute. GENerate BINomial random deviate Function Generates a single random deviate from a binomial distribution whose number of trials is N and whose probability of an event in each trial is P. Arguments N --> The number of trials in the binomial distribution from which a random deviate is to be generated. INTEGER N P --> The probability of an event in each trial of the binomial distribution from which a random deviate is to be generated. REAL P FIRST --> Set FIRST = .TRUE. for the first call to perform initialization the set FIRST = .FALSE. for further calls using the same pair of parameter values (N, P). LOGICAL FIRST random_binomial2 <-- A random deviate yielding the number of events from N independent trials, each of which has a probability of event P. INTEGER random_binomial Method This is algorithm BTPE from: Kachitvichyanukul, V. and Schmeiser, B. W. Binomial Random Variate Generation. Communications of the ACM, 31, 2 (February, 1988) 216.


*DETERMINE APPROPRIATE ALGORITHM AND WHETHER SETUP IS NECESSARY .. .. Scalar Arguments .. GENERATE VARIATE, Binomial mean at least 30. ***DETERMINE APPROPRIATE WAY TO PERFORM ACCEPT/REJECT TEST

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real, intent(in) :: pp
logical, intent(in) :: first

Return Value integer