EMPIRE DA
v1.9.1
Data assimilation codes using EMPIRE communication
Main Page
Related Pages
Data Types List
Files
Assimilation Methods
Other features
How to cite EMPIRE
Tutorials
File List
File Members
All
Classes
Files
Functions
Variables
Pages
randperm.f90
Go to the documentation of this file.
1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2
!!! Time-stamp: <2015-05-21 13:32:24 pbrowne>
3
!!!
4
!!! Subroutine to create an array for random permutations
5
!!! Copyright (C) 2015 Mengbin Zhu
6
!!!
7
!!! This program is free software: you can redistribute it and/or modify
8
!!! it under the terms of the GNU General Public License as published by
9
!!! the Free Software Foundation, either version 3 of the License, or
10
!!! (at your option) any later version.
11
!!!
12
!!! This program is distributed in the hope that it will be useful,
13
!!! but WITHOUT ANY WARRANTY; without even the implied warranty of
14
!!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
!!! GNU General Public License for more details.
16
!!!
17
!!! You should have received a copy of the GNU General Public License
18
!!! along with this program. If not, see <http://www.gnu.org/licenses/>.
19
!!!
20
!!! Email: zhumengbin @ gmail.com
21
!!! Mail: School of Mathematical and Physical Sciences,
22
!!! University of Reading,
23
!!! Reading, UK
24
!!! RG6 6BB
25
!!!
26
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
30
subroutine
randperm
(N, p)
31
implicit none
32
integer
,
intent(in)
:: N
33
integer
,
dimension(N)
,
intent(out)
:: p
35
36
integer
:: i, j, k
37
integer
:: temp
38
real(kind=kind(1.0d0))
:: u
39
40
p = (/ (i, i=1,n) /)
41
42
do
j=n,2,-1
43
44
call random_number(u)
45
46
k = floor(j*u) + 1
47
48
! exchange p(k) and p(j)
49
temp = p(k)
50
p(k) = p(j)
51
p(j) = temp
52
53
end do
54
55
end subroutine
randperm
randperm
subroutine randperm(N, p)
subroutine to create an array of a random permutations of the natural numbers from 1 to N ...
Definition:
randperm.f90:30
src
utils
randperm.f90
Generated on Tue Dec 13 2016 18:44:26 for EMPIRE DA by
1.8.8