Next: V113 Fast Uniform
Up: CERNLIB
Previous: V111 Binomial Random
Routine ID: V112


Author(s): D. Drijard  Library: MATHLIB

Submitter:  Submitted: 15.09.1978

Language: Fortran  Revised:

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
$n$_{i} (i=1,2,...,N)
with probabilities $p$_{i}
according to a multinomial law:
$Prob(n$_{1},n_{2},...,n_{N}) = {(n_{1}+n_{2}+...+n_{N})!n_{1}! n_{2}! ... n_{N}!} p_{1}^{n1} p_{2}^{n2} ... p_{N}^{nN} .
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 $n$_{i}
requested.
 NTOT
 ( INTEGER) Equals $\sum $_{i=1}^{N}n_{i}
,
specified by the user.
 P
 ( REAL) Onedimensional 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) Onedimensional 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:$
$\sum P(i)\; >\; 1$
.
$\u2022$
V113
Janne Saarela
Mon Apr 3 15:06:23 METDST 1995