next up previous index
Next: V113 Fast Uniform Up: CERNLIB Previous: V111 Binomial Random

V112 Multinomial Random Numbers

Routine ID: V112
Author(s): D. DrijardLibrary: MATHLIB
Submitter: Submitted: 15.09.1978
Language: FortranRevised:

OBSOLETE

Please note that this routine has been obsoleted in CNL 218. Users are advised not to use it any longer and to replace it in older programs. No maintenance for it will take place and it will eventually disappear.
Suggested replacement: RNMNML (V138)

MUNOMI generates a vector of random integers ni (i=1,2,...,N) with probabilities pi

according to a multinomial law:

Prob(n1,n2,...,nN) = {(n1+n2+...+nN)!n1! n2! ... nN!} p1n1 p2n2 ... pNnN .

Structure:

SUBROUTINE subprogram
User Entry Names: MUNOMI
External References: RNDM (V104), UZERO (V300)

Usage:

    CALL MUNOMI(NCH,NTOT,P,N,IERR)
NCH
( INTEGER) Number N of random integers ni

requested.

NTOT
( INTEGER) Equals i=1Nni , specified by the user.
P
( REAL) One-dimensional array of length NCH at least. On entry, it contains in P(i) the probability of channel i. On return, it contains the cumulative channel probabilities so that P(NCH)=1 . If P(NCH)=1 on entry, it is assumed that P(i) contains the cumulative probabilities rather than the individual probabilites, which saves some time.
N
( INTEGER) One-dimensional array of length NCH at least. On return, N(i) contains the generated random integers.
IERR
Error flag.
= 0: Normal case,
= 1: At least one P(i) < 0 ,
= 2: P(i) > 1 .

V113


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995