C Library Functions  - ranper (3)

NAME

ranper(3f) - [M_datapac:RANDOM] generates a random permutation

CONTENTS

Synopsis
Description
Input Arguments
Output Arguments
Examples
Author
Maintainer
License

SYNOPSIS

SUBROUTINE RANPER(N,Istart,X)

       INTEGER,intent(in)    :: N
       INTEGER,intent(inout) :: Istart
       REAL(kind=wp)         :: X(:)

DESCRIPTION

RANPER(3f) generates a random permutation of size N of the values 1.0, 2.0, 3.0, ..., N-1, N.

INPUT ARGUMENTS

N The desired integer size of the random 1 to N permutation.
ISTART An integer flag code which (if set to 0) will start the generator over and hence produce the same random permutation over and over again upon successive calls to this subroutine within a run; or (if set to some integer value not equal to 0, like, say, 1) will allow the generator to continue from where it stopped and hence produce different random permutations upon successive calls to this subroutine within a run.

OUTPUT ARGUMENTS

X A vector (of dimension at least N) into which the generated random permutation will be placed of size N of the values 1.0, 2.0, 3.0, ..., n-1, n.

EXAMPLES

Sample program:

   program demo_ranper
   use M_datapac, only : ranper
   implicit none
   integer,parameter :: n=10
   integer           :: istart
   real              :: x(n)
   integer           :: i
      do i=1,3
         istart=i
         call  RANPER(N,Istart,X)
         write(*,*)istart
         write(*,’(*(g0.2,1x))’)x
      enddo
   end program demo_ranper

AUTHOR

The original DATAPAC library was written by James Filliben of the Statistical Engineering Division, National Institute of Standards and Technology.

Algorithm suggested by Dan Lozier, National Bureau of Standards (205.01).

MAINTAINER

John Urban, 2022.05.31

LICENSE

CC0-1.0


Nemo Release 3.1 ranper (3) July 22, 2023
Generated by manServer 1.08 from 7668ff0a-f1f6-42d7-9287-d5458025b206 using man macros.