GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
genprm.f
Go to the documentation of this file.
1  SUBROUTINE genprm(iarray,larray)
2 C**********************************************************************
3 C
4 C SUBROUTINE GENPRM( IARRAY, LARRAY )
5 C GENerate random PeRMutation of iarray
6 C
7 C
8 C Arguments
9 C
10 C
11 C IARRAY <--> On output IARRAY is a random permutation of its
12 C value on input
13 C INTEGER IARRAY( LARRAY )
14 C
15 C LARRAY <--> Length of IARRAY
16 C INTEGER LARRAY
17 C
18 C**********************************************************************
19 C .. Scalar Arguments ..
20  INTEGER larray
21 C ..
22 C .. Array Arguments ..
23  INTEGER iarray(larray)
24 C ..
25 C .. Local Scalars ..
26  INTEGER i,itmp,iwhich
27 C ..
28 C .. External Functions ..
29  INTEGER ignuin
30  EXTERNAL ignuin
31 C ..
32 C .. Executable Statements ..
33  DO 10,i = 1,larray
34  iwhich = ignuin(i,larray)
35  itmp = iarray(iwhich)
36  iarray(iwhich) = iarray(i)
37  iarray(i) = itmp
38  10 CONTINUE
39  RETURN
40 
41  END