ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_arrayShuffle::setShuffled Interface Reference

Perform an unbiased random shuffling of the input array, known as the Knuth or Fisher-Yates shuffle. More...

Detailed Description

Perform an unbiased random shuffling of the input array, known as the Knuth or Fisher-Yates shuffle.

Parameters
[in,out]rng: The input/output scalar that can be an object of,
  1. type rngf_type, implying the use of intrinsic Fortran uniform RNG.
  2. type xoshiro256ssw_type, implying the use of xoshiro256** uniform RNG.
(optional, default = rngf_type, implying the use of the intrinsic Fortran URNG.)
[in,out]array: The input/output contiguous array of shape (:) of either
  1. type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU),
  2. type logical of kind any supported by the processor (e.g., LK),
  3. type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64),
  4. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
  5. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
or,
  1. a scalar assumed-length character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU),
whose first (1:count) elements will be shuffled uniformly-randomly on return.
The rest of the elements of array(count + 1:) will be shuffled but non-uniformly.
[in]count: The input positive scalar integer of default kind IK, containing the number of elements of the unique uniformly-random draws (shuffled elements) from the input array.
If specified, only the first count elements of the input/output sequence array are guaranteed to be randomly uniformly shuffled.
The specified count must not be larger than the length of the input sequence array.
(optional, default = len(array) for scalar character input array, otherwise size(array).)


Possible calling interfaces

call setShuffled(array, count = count)
call setShuffled(rng, array, count = count)
Perform an unbiased random shuffling of the input array, known as the Knuth or Fisher-Yates shuffle.
This module contains procedures and generic interfaces for shuffling arrays of various types.
Warning
The condition 0 <= count must hold for the corresponding input arguments.
The condition count <= lenArray must hold for the corresponding input arguments where lenArray represents the length of the input sequence.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
Remarks
The procedures under discussion are impure. The procedures of this generic interface become pure in release build mode when the input argument rng is set to an object of type xoshiro256ssw_type.
See also
getChoice
setChoice
getRemapped
setRemapped
getReversed
setReversed


Example usage

1program example
2
3 use pm_kind, only: LK ! All kinds are supported.
4 use pm_kind, only: SK ! All kinds are supported.
5 use pm_kind, only: IK ! All kinds are supported.
6 use pm_kind, only: CK ! All kinds are supported.
7 use pm_kind, only: RK ! All kinds are supported.
8 use pm_io, only: display_type
9 use pm_distUnif, only: getUnifRand
11
12 implicit none
13
14 integer(IK) :: count, itry, ntry = 10
15 type(display_type) :: disp
16 disp = display_type(file = "main.out.F90")
17
18 block
19 character(:), allocatable :: array
20 do itry = 1, ntry
21
22 call disp%skip
23 call disp%show("count = getUnifRand(4, 10)")
24 count = getUnifRand(4, 10)
25 call disp%show("array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.")
26 array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
27 call disp%show("array")
28 call disp%show( array, deliml = SK_"""" )
29 call disp%show("call setShuffled(array)")
30 call setShuffled(array)
31 call disp%show("array")
32 call disp%show( array, deliml = SK_"""" )
33
34 call disp%skip
35 call disp%show("count = getUnifRand(0, len(array))")
36 count = getUnifRand(0, len(array))
37 call disp%show("count")
38 call disp%show( count )
39 call disp%show("call setShuffled(array, count) ! draw randomly only `count` elements without replacement.")
40 call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
41 call disp%show("array")
42 call disp%show( array, deliml = SK_"""" )
43
44 end do
45 end block
46
47 block
48 character(2), allocatable :: array(:)
49 do itry = 1, ntry
50
51 call disp%skip
52 call disp%show("count = getUnifRand(4, 10)")
53 count = getUnifRand(4, 10)
54 call disp%show("array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.")
55 array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
56 call disp%show("array")
57 call disp%show( array, deliml = SK_"""" )
58 call disp%show("call setShuffled(array)")
59 call setShuffled(array)
60 call disp%show("array")
61 call disp%show( array, deliml = SK_"""" )
62
63 call disp%skip
64 call disp%show("count = getUnifRand(0, size(array))")
65 count = getUnifRand(0, size(array))
66 call disp%show("count")
67 call disp%show( count )
68 call disp%show("call setShuffled(array, count) ! draw randomly only `count` elements without replacement.")
69 call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
70 call disp%show("array")
71 call disp%show( array, deliml = SK_"""" )
72
73 end do
74 end block
75
76 block
77 integer, allocatable :: array(:)
78 do itry = 1, ntry
79
80 call disp%skip
81 call disp%show("count = getUnifRand(4, 10)")
82 count = getUnifRand(4, 10)
83 call disp%show("array = getUnifRand(0, 9, count) ! generate random array for illustration.")
84 array = getUnifRand(0, 9, count) ! generate random array for illustration.
85 call disp%show("array")
86 call disp%show( array )
87 call disp%show("call setShuffled(array)")
88 call setShuffled(array)
89 call disp%show("array")
90 call disp%show( array )
91
92 call disp%skip
93 call disp%show("count = getUnifRand(0, size(array))")
94 count = getUnifRand(0, size(array))
95 call disp%show("count")
96 call disp%show( count )
97 call disp%show("call setShuffled(array, count) ! draw randomly only `count` elements without replacement.")
98 call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
99 call disp%show("array")
100 call disp%show( array )
101
102 end do
103 end block
104
105 block
106 logical, allocatable :: array(:)
107 do itry = 1, ntry
108
109 call disp%skip
110 call disp%show("count = getUnifRand(4, 10)")
111 count = getUnifRand(4, 10)
112 call disp%show("array = getUnifRand(.false., .true., count) ! generate random array for illustration.")
113 array = getUnifRand(.false., .true., count) ! generate random array for illustration.
114 call disp%show("array")
115 call disp%show( array )
116 call disp%show("call setShuffled(array)")
117 call setShuffled(array)
118 call disp%show("array")
119 call disp%show( array )
120
121 call disp%skip
122 call disp%show("count = getUnifRand(0, size(array))")
123 count = getUnifRand(0, size(array))
124 call disp%show("count")
125 call disp%show( count )
126 call disp%show("call setShuffled(array, count) ! draw randomly only `count` elements without replacement.")
127 call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
128 call disp%show("array")
129 call disp%show( array )
130
131 end do
132 end block
133
134 block
135 complex, allocatable :: array(:)
136 do itry = 1, ntry
137
138 call disp%skip
139 call disp%show("count = getUnifRand(4, 10)")
140 count = getUnifRand(4, 10)
141 call disp%show("array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.")
142 array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
143 call disp%show("array")
144 call disp%show( array )
145 call disp%show("call setShuffled(array)")
146 call setShuffled(array)
147 call disp%show("array")
148 call disp%show( array )
149
150 call disp%skip
151 call disp%show("count = getUnifRand(0, size(array))")
152 count = getUnifRand(0, size(array))
153 call disp%show("count")
154 call disp%show( count )
155 call disp%show("call setShuffled(array, count) ! draw randomly only `count` elements without replacement.")
156 call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
157 call disp%show("array")
158 call disp%show( array )
159
160 end do
161 end block
162
163 block
164 real, allocatable :: array(:)
165 do itry = 1, ntry
166
167 call disp%skip
168 call disp%show("count = getUnifRand(4, 10)")
169 count = getUnifRand(4, 10)
170 call disp%show("array = getUnifRand(0., 1., count) ! generate random array for illustration.")
171 array = getUnifRand(0., 1., count) ! generate random array for illustration.
172 call disp%show("array")
173 call disp%show( array )
174 call disp%show("call setShuffled(array)")
175 call setShuffled(array)
176 call disp%show("array")
177 call disp%show( array )
178
179 call disp%skip
180 call disp%show("count = getUnifRand(0, size(array))")
181 count = getUnifRand(0, size(array))
182 call disp%show("count")
183 call disp%show( count )
184 call disp%show("call setShuffled(array, count) ! draw randomly only `count` elements without replacement.")
185 call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
186 call disp%show("array")
187 call disp%show( array )
188
189 end do
190 end block
191
192end program example
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
Definition: pm_kind.F90:542
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2count = getUnifRand(4, 10)
3array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
4array
5"KDXWGFQB"
6call setShuffled(array)
7array
8"GXDWQFKB"
9
10count = getUnifRand(0, len(array))
11count
12+1
13call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
14array
15"BXDWQFKG"
16
17count = getUnifRand(4, 10)
18array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
19array
20"FJLJHGAEWZ"
21call setShuffled(array)
22array
23"JHWLAGEJZF"
24
25count = getUnifRand(0, len(array))
26count
27+5
28call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
29array
30"FGEZLHWJAJ"
31
32count = getUnifRand(4, 10)
33array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
34array
35"HYIWUTCMJX"
36call setShuffled(array)
37array
38"WHMCXYITJU"
39
40count = getUnifRand(0, len(array))
41count
42+0
43call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
44array
45"WHMCXYITJU"
46
47count = getUnifRand(4, 10)
48array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
49array
50"RIMM"
51call setShuffled(array)
52array
53"MIRM"
54
55count = getUnifRand(0, len(array))
56count
57+0
58call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
59array
60"MIRM"
61
62count = getUnifRand(4, 10)
63array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
64array
65"PXDN"
66call setShuffled(array)
67array
68"DNPX"
69
70count = getUnifRand(0, len(array))
71count
72+3
73call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
74array
75"NDXP"
76
77count = getUnifRand(4, 10)
78array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
79array
80"ROFGB"
81call setShuffled(array)
82array
83"RBGOF"
84
85count = getUnifRand(0, len(array))
86count
87+5
88call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
89array
90"GRFOB"
91
92count = getUnifRand(4, 10)
93array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
94array
95"TMRVISRRS"
96call setShuffled(array)
97array
98"RRSIMSRVT"
99
100count = getUnifRand(0, len(array))
101count
102+4
103call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
104array
105"VSRTMSRRI"
106
107count = getUnifRand(4, 10)
108array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
109array
110"UUAQF"
111call setShuffled(array)
112array
113"QUUAF"
114
115count = getUnifRand(0, len(array))
116count
117+2
118call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
119array
120"QUUAF"
121
122count = getUnifRand(4, 10)
123array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
124array
125"PANGRU"
126call setShuffled(array)
127array
128"RAUPGN"
129
130count = getUnifRand(0, len(array))
131count
132+0
133call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
134array
135"RAUPGN"
136
137count = getUnifRand(4, 10)
138array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
139array
140"OPKCALOMR"
141call setShuffled(array)
142array
143"CLROPKMOA"
144
145count = getUnifRand(0, len(array))
146count
147+2
148call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
149array
150"MLROPKCOA"
151
152count = getUnifRand(4, 10)
153array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
154array
155"IY", "YP", "EK", "YH"
156call setShuffled(array)
157array
158"YH", "YP", "EK", "IY"
159
160count = getUnifRand(0, size(array))
161count
162+0
163call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
164array
165"YH", "YP", "EK", "IY"
166
167count = getUnifRand(4, 10)
168array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
169array
170"XF", "AS", "BS", "AB", "PP", "CN", "UM"
171call setShuffled(array)
172array
173"AS", "AB", "XF", "UM", "PP", "BS", "CN"
174
175count = getUnifRand(0, size(array))
176count
177+1
178call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
179array
180"CN", "AB", "XF", "UM", "PP", "BS", "AS"
181
182count = getUnifRand(4, 10)
183array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
184array
185"OV", "XW", "OB", "WD", "LO", "ZC", "CK", "PH", "OF"
186call setShuffled(array)
187array
188"ZC", "CK", "XW", "WD", "PH", "OB", "OV", "OF", "LO"
189
190count = getUnifRand(0, size(array))
191count
192+4
193call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
194array
195"ZC", "LO", "WD", "OB", "PH", "XW", "OV", "OF", "CK"
196
197count = getUnifRand(4, 10)
198array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
199array
200"AM", "AW", "YW", "IC", "LA", "LX"
201call setShuffled(array)
202array
203"AM", "IC", "AW", "LX", "YW", "LA"
204
205count = getUnifRand(0, size(array))
206count
207+4
208call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
209array
210"LA", "YW", "IC", "LX", "AW", "AM"
211
212count = getUnifRand(4, 10)
213array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
214array
215"NO", "BY", "JN", "YL", "OZ", "SW", "XU", "WK"
216call setShuffled(array)
217array
218"BY", "XU", "NO", "OZ", "JN", "WK", "YL", "SW"
219
220count = getUnifRand(0, size(array))
221count
222+0
223call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
224array
225"BY", "XU", "NO", "OZ", "JN", "WK", "YL", "SW"
226
227count = getUnifRand(4, 10)
228array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
229array
230"HV", "DB", "GP", "UN", "RE", "ID", "KY"
231call setShuffled(array)
232array
233"UN", "DB", "RE", "ID", "GP", "KY", "HV"
234
235count = getUnifRand(0, size(array))
236count
237+6
238call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
239array
240"DB", "RE", "UN", "ID", "GP", "HV", "KY"
241
242count = getUnifRand(4, 10)
243array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
244array
245"XJ", "OJ", "AP", "ZN", "DL", "QQ", "WO", "OL"
246call setShuffled(array)
247array
248"AP", "XJ", "QQ", "OL", "WO", "ZN", "DL", "OJ"
249
250count = getUnifRand(0, size(array))
251count
252+1
253call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
254array
255"AP", "XJ", "QQ", "OL", "WO", "ZN", "DL", "OJ"
256
257count = getUnifRand(4, 10)
258array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
259array
260"WJ", "IO", "JQ", "UG", "ZB", "LW", "YN", "BA"
261call setShuffled(array)
262array
263"IO", "LW", "JQ", "YN", "WJ", "BA", "ZB", "UG"
264
265count = getUnifRand(0, size(array))
266count
267+2
268call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
269array
270"IO", "WJ", "JQ", "YN", "LW", "BA", "ZB", "UG"
271
272count = getUnifRand(4, 10)
273array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
274array
275"FF", "WP", "LX", "TG", "BV", "NX", "PY", "XS"
276call setShuffled(array)
277array
278"TG", "FF", "LX", "XS", "BV", "NX", "WP", "PY"
279
280count = getUnifRand(0, size(array))
281count
282+2
283call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
284array
285"LX", "XS", "TG", "FF", "BV", "NX", "WP", "PY"
286
287count = getUnifRand(4, 10)
288array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
289array
290"XW", "CP", "GW", "LL"
291call setShuffled(array)
292array
293"CP", "GW", "XW", "LL"
294
295count = getUnifRand(0, size(array))
296count
297+2
298call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
299array
300"CP", "LL", "XW", "GW"
301
302count = getUnifRand(4, 10)
303array = getUnifRand(0, 9, count) ! generate random array for illustration.
304array
305+1, +4, +0, +7, +7
306call setShuffled(array)
307array
308+0, +4, +7, +7, +1
309
310count = getUnifRand(0, size(array))
311count
312+5
313call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
314array
315+4, +7, +0, +1, +7
316
317count = getUnifRand(4, 10)
318array = getUnifRand(0, 9, count) ! generate random array for illustration.
319array
320+2, +5, +5, +6, +1, +0
321call setShuffled(array)
322array
323+0, +5, +5, +2, +6, +1
324
325count = getUnifRand(0, size(array))
326count
327+6
328call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
329array
330+1, +2, +0, +6, +5, +5
331
332count = getUnifRand(4, 10)
333array = getUnifRand(0, 9, count) ! generate random array for illustration.
334array
335+0, +9, +8, +2, +0, +3, +7
336call setShuffled(array)
337array
338+7, +3, +0, +0, +2, +9, +8
339
340count = getUnifRand(0, size(array))
341count
342+1
343call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
344array
345+0, +3, +7, +0, +2, +9, +8
346
347count = getUnifRand(4, 10)
348array = getUnifRand(0, 9, count) ! generate random array for illustration.
349array
350+4, +0, +3, +5, +7, +9, +1, +0, +4
351call setShuffled(array)
352array
353+5, +0, +4, +7, +0, +9, +1, +4, +3
354
355count = getUnifRand(0, size(array))
356count
357+9
358call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
359array
360+4, +4, +7, +3, +0, +0, +1, +9, +5
361
362count = getUnifRand(4, 10)
363array = getUnifRand(0, 9, count) ! generate random array for illustration.
364array
365+8, +4, +5, +0, +8, +1, +5, +8
366call setShuffled(array)
367array
368+4, +8, +0, +8, +8, +5, +5, +1
369
370count = getUnifRand(0, size(array))
371count
372+4
373call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
374array
375+4, +8, +8, +5, +0, +5, +8, +1
376
377count = getUnifRand(4, 10)
378array = getUnifRand(0, 9, count) ! generate random array for illustration.
379array
380+6, +8, +2, +6, +5, +2, +3
381call setShuffled(array)
382array
383+5, +2, +2, +6, +3, +6, +8
384
385count = getUnifRand(0, size(array))
386count
387+4
388call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
389array
390+6, +6, +2, +8, +3, +5, +2
391
392count = getUnifRand(4, 10)
393array = getUnifRand(0, 9, count) ! generate random array for illustration.
394array
395+8, +3, +1, +9, +7, +7, +8, +2
396call setShuffled(array)
397array
398+2, +1, +7, +8, +3, +8, +7, +9
399
400count = getUnifRand(0, size(array))
401count
402+1
403call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
404array
405+8, +1, +7, +8, +3, +2, +7, +9
406
407count = getUnifRand(4, 10)
408array = getUnifRand(0, 9, count) ! generate random array for illustration.
409array
410+0, +6, +1, +9, +0, +4
411call setShuffled(array)
412array
413+0, +1, +0, +6, +4, +9
414
415count = getUnifRand(0, size(array))
416count
417+2
418call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
419array
420+6, +9, +0, +0, +4, +1
421
422count = getUnifRand(4, 10)
423array = getUnifRand(0, 9, count) ! generate random array for illustration.
424array
425+7, +3, +7, +1, +5, +5, +2, +0
426call setShuffled(array)
427array
428+0, +5, +5, +1, +2, +3, +7, +7
429
430count = getUnifRand(0, size(array))
431count
432+5
433call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
434array
435+7, +5, +2, +1, +5, +3, +7, +0
436
437count = getUnifRand(4, 10)
438array = getUnifRand(0, 9, count) ! generate random array for illustration.
439array
440+4, +6, +4, +4, +5, +4, +1, +3
441call setShuffled(array)
442array
443+6, +4, +4, +4, +1, +3, +4, +5
444
445count = getUnifRand(0, size(array))
446count
447+0
448call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
449array
450+6, +4, +4, +4, +1, +3, +4, +5
451
452count = getUnifRand(4, 10)
453array = getUnifRand(.false., .true., count) ! generate random array for illustration.
454array
455F, F, T, T, T, T
456call setShuffled(array)
457array
458T, T, T, F, T, F
459
460count = getUnifRand(0, size(array))
461count
462+1
463call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
464array
465T, T, T, F, T, F
466
467count = getUnifRand(4, 10)
468array = getUnifRand(.false., .true., count) ! generate random array for illustration.
469array
470F, F, F, F
471call setShuffled(array)
472array
473F, F, F, F
474
475count = getUnifRand(0, size(array))
476count
477+2
478call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
479array
480F, F, F, F
481
482count = getUnifRand(4, 10)
483array = getUnifRand(.false., .true., count) ! generate random array for illustration.
484array
485T, F, F, T, F, T, T, T, F, F
486call setShuffled(array)
487array
488T, T, F, F, T, F, F, T, T, F
489
490count = getUnifRand(0, size(array))
491count
492+1
493call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
494array
495T, T, F, F, T, F, F, T, T, F
496
497count = getUnifRand(4, 10)
498array = getUnifRand(.false., .true., count) ! generate random array for illustration.
499array
500F, T, F, F, T, F, T, F
501call setShuffled(array)
502array
503T, F, T, T, F, F, F, F
504
505count = getUnifRand(0, size(array))
506count
507+2
508call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
509array
510T, F, T, T, F, F, F, F
511
512count = getUnifRand(4, 10)
513array = getUnifRand(.false., .true., count) ! generate random array for illustration.
514array
515F, T, T, F, T, F, F, F
516call setShuffled(array)
517array
518F, T, T, F, F, T, F, F
519
520count = getUnifRand(0, size(array))
521count
522+0
523call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
524array
525F, T, T, F, F, T, F, F
526
527count = getUnifRand(4, 10)
528array = getUnifRand(.false., .true., count) ! generate random array for illustration.
529array
530F, T, T, T, T, F
531call setShuffled(array)
532array
533T, T, T, F, T, F
534
535count = getUnifRand(0, size(array))
536count
537+1
538call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
539array
540T, T, T, F, T, F
541
542count = getUnifRand(4, 10)
543array = getUnifRand(.false., .true., count) ! generate random array for illustration.
544array
545T, T, F, T, T, T
546call setShuffled(array)
547array
548F, T, T, T, T, T
549
550count = getUnifRand(0, size(array))
551count
552+3
553call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
554array
555T, T, F, T, T, T
556
557count = getUnifRand(4, 10)
558array = getUnifRand(.false., .true., count) ! generate random array for illustration.
559array
560T, F, F, F, F
561call setShuffled(array)
562array
563T, F, F, F, F
564
565count = getUnifRand(0, size(array))
566count
567+3
568call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
569array
570F, F, T, F, F
571
572count = getUnifRand(4, 10)
573array = getUnifRand(.false., .true., count) ! generate random array for illustration.
574array
575F, F, F, F
576call setShuffled(array)
577array
578F, F, F, F
579
580count = getUnifRand(0, size(array))
581count
582+0
583call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
584array
585F, F, F, F
586
587count = getUnifRand(4, 10)
588array = getUnifRand(.false., .true., count) ! generate random array for illustration.
589array
590F, F, F, F, F, F
591call setShuffled(array)
592array
593F, F, F, F, F, F
594
595count = getUnifRand(0, size(array))
596count
597+3
598call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
599array
600F, F, F, F, F, F
601
602count = getUnifRand(4, 10)
603array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
604array
605(+0.361772358, +0.955501437), (+0.617043674, +0.184953690), (+0.201858938, +0.777549684), (+0.983403265, +0.807987213), (+0.934765458, +0.185687184), (+0.804181039, +0.488167226), (+0.349350154, +0.659238458), (+0.506047845, +0.459811449), (+0.827084363, +0.363054156), (+0.815816522E-1, +0.314366281)
606call setShuffled(array)
607array
608(+0.804181039, +0.488167226), (+0.361772358, +0.955501437), (+0.815816522E-1, +0.314366281), (+0.983403265, +0.807987213), (+0.617043674, +0.184953690), (+0.201858938, +0.777549684), (+0.506047845, +0.459811449), (+0.349350154, +0.659238458), (+0.827084363, +0.363054156), (+0.934765458, +0.185687184)
609
610count = getUnifRand(0, size(array))
611count
612+5
613call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
614array
615(+0.506047845, +0.459811449), (+0.983403265, +0.807987213), (+0.361772358, +0.955501437), (+0.815816522E-1, +0.314366281), (+0.349350154, +0.659238458), (+0.201858938, +0.777549684), (+0.804181039, +0.488167226), (+0.617043674, +0.184953690), (+0.827084363, +0.363054156), (+0.934765458, +0.185687184)
616
617count = getUnifRand(4, 10)
618array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
619array
620(+0.924579501E-1, +0.768085063), (+0.722191334E-1, +0.539067090), (+0.756772339, +0.891037405), (+0.571614385, +0.264309287), (+0.204714477, +0.996463418), (+0.905461431, +0.512933135), (+0.793388665, +0.126297891), (+0.536512196, +0.127815187), (+0.529364944, +0.552898824)
621call setShuffled(array)
622array
623(+0.905461431, +0.512933135), (+0.793388665, +0.126297891), (+0.536512196, +0.127815187), (+0.204714477, +0.996463418), (+0.924579501E-1, +0.768085063), (+0.571614385, +0.264309287), (+0.756772339, +0.891037405), (+0.722191334E-1, +0.539067090), (+0.529364944, +0.552898824)
624
625count = getUnifRand(0, size(array))
626count
627+1
628call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
629array
630(+0.905461431, +0.512933135), (+0.793388665, +0.126297891), (+0.536512196, +0.127815187), (+0.204714477, +0.996463418), (+0.924579501E-1, +0.768085063), (+0.571614385, +0.264309287), (+0.756772339, +0.891037405), (+0.722191334E-1, +0.539067090), (+0.529364944, +0.552898824)
631
632count = getUnifRand(4, 10)
633array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
634array
635(+0.393612444, +0.533764005), (+0.437731266, +0.844150901), (+0.946881354, +0.408884287), (+0.975791812E-1, +0.120846331), (+0.887804329, +0.637111068E-1), (+0.963483989, +0.611198306), (+0.337187707, +0.753525794), (+0.549887776, +0.277787387), (+0.205967247, +0.596685171), (+0.868275285, +0.881084204)
636call setShuffled(array)
637array
638(+0.437731266, +0.844150901), (+0.946881354, +0.408884287), (+0.549887776, +0.277787387), (+0.337187707, +0.753525794), (+0.975791812E-1, +0.120846331), (+0.887804329, +0.637111068E-1), (+0.868275285, +0.881084204), (+0.963483989, +0.611198306), (+0.205967247, +0.596685171), (+0.393612444, +0.533764005)
639
640count = getUnifRand(0, size(array))
641count
642+10
643call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
644array
645(+0.549887776, +0.277787387), (+0.393612444, +0.533764005), (+0.337187707, +0.753525794), (+0.946881354, +0.408884287), (+0.205967247, +0.596685171), (+0.963483989, +0.611198306), (+0.868275285, +0.881084204), (+0.975791812E-1, +0.120846331), (+0.437731266, +0.844150901), (+0.887804329, +0.637111068E-1)
646
647count = getUnifRand(4, 10)
648array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
649array
650(+0.985491097, +0.961772799), (+0.859250903, +0.520161450), (+0.534339666, +0.799456000), (+0.945103645, +0.838083029E-1), (+0.117124915, +0.923276126), (+0.747200966, +0.504460931E-1), (+0.481893778, +0.111860335), (+0.187731206, +0.543216467E-1), (+0.945417941, +0.259717286), (+0.652490556, +0.400341868)
651call setShuffled(array)
652array
653(+0.945417941, +0.259717286), (+0.117124915, +0.923276126), (+0.985491097, +0.961772799), (+0.481893778, +0.111860335), (+0.534339666, +0.799456000), (+0.859250903, +0.520161450), (+0.747200966, +0.504460931E-1), (+0.652490556, +0.400341868), (+0.945103645, +0.838083029E-1), (+0.187731206, +0.543216467E-1)
654
655count = getUnifRand(0, size(array))
656count
657+4
658call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
659array
660(+0.652490556, +0.400341868), (+0.985491097, +0.961772799), (+0.945103645, +0.838083029E-1), (+0.534339666, +0.799456000), (+0.481893778, +0.111860335), (+0.859250903, +0.520161450), (+0.747200966, +0.504460931E-1), (+0.945417941, +0.259717286), (+0.117124915, +0.923276126), (+0.187731206, +0.543216467E-1)
661
662count = getUnifRand(4, 10)
663array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
664array
665(+0.922179699, +0.236639738), (+0.580540776, +0.508219004E-1), (+0.113545477, +0.248542786), (+0.474353015, +0.789928138), (+0.964556992, +0.461170733), (+0.504411221, +0.846972466), (+0.260459483, +0.771470487), (+0.603639483, +0.191518784), (+0.791213095, +0.990383446), (+0.592488647, +0.447277486)
666call setShuffled(array)
667array
668(+0.474353015, +0.789928138), (+0.922179699, +0.236639738), (+0.113545477, +0.248542786), (+0.504411221, +0.846972466), (+0.791213095, +0.990383446), (+0.580540776, +0.508219004E-1), (+0.592488647, +0.447277486), (+0.603639483, +0.191518784), (+0.964556992, +0.461170733), (+0.260459483, +0.771470487)
669
670count = getUnifRand(0, size(array))
671count
672+9
673call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
674array
675(+0.580540776, +0.508219004E-1), (+0.260459483, +0.771470487), (+0.504411221, +0.846972466), (+0.922179699, +0.236639738), (+0.474353015, +0.789928138), (+0.791213095, +0.990383446), (+0.603639483, +0.191518784), (+0.113545477, +0.248542786), (+0.964556992, +0.461170733), (+0.592488647, +0.447277486)
676
677count = getUnifRand(4, 10)
678array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
679array
680(+0.178596616, +0.975894332), (+0.888358235, +0.165087402), (+0.308247089, +0.647616982E-1), (+0.806265473E-1, +0.273456812), (+0.795409203, +0.458876133), (+0.330556989, +0.956825793), (+0.429529071, +0.371285737), (+0.739782989, +0.174697459)
681call setShuffled(array)
682array
683(+0.178596616, +0.975894332), (+0.806265473E-1, +0.273456812), (+0.308247089, +0.647616982E-1), (+0.795409203, +0.458876133), (+0.888358235, +0.165087402), (+0.429529071, +0.371285737), (+0.739782989, +0.174697459), (+0.330556989, +0.956825793)
684
685count = getUnifRand(0, size(array))
686count
687+7
688call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
689array
690(+0.178596616, +0.975894332), (+0.739782989, +0.174697459), (+0.330556989, +0.956825793), (+0.429529071, +0.371285737), (+0.806265473E-1, +0.273456812), (+0.308247089, +0.647616982E-1), (+0.795409203, +0.458876133), (+0.888358235, +0.165087402)
691
692count = getUnifRand(4, 10)
693array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
694array
695(+0.224467576, +0.336859822E-1), (+0.201984346, +0.731784523), (+0.172143281, +0.269536614), (+0.605288684, +0.262714446), (+0.798157215, +0.386693180), (+0.570110738, +0.714444160)
696call setShuffled(array)
697array
698(+0.201984346, +0.731784523), (+0.605288684, +0.262714446), (+0.798157215, +0.386693180), (+0.570110738, +0.714444160), (+0.224467576, +0.336859822E-1), (+0.172143281, +0.269536614)
699
700count = getUnifRand(0, size(array))
701count
702+2
703call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
704array
705(+0.570110738, +0.714444160), (+0.224467576, +0.336859822E-1), (+0.798157215, +0.386693180), (+0.201984346, +0.731784523), (+0.605288684, +0.262714446), (+0.172143281, +0.269536614)
706
707count = getUnifRand(4, 10)
708array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
709array
710(+0.428317308, +0.116203010), (+0.867605209E-3, +0.268216252), (+0.645414293, +0.697404981), (+0.496494353, +0.477706015), (+0.111836314, +0.924725294), (+0.373916984, +0.348259628), (+0.406593084E-1, +0.188141584), (+0.182938874, +0.642279983E-1), (+0.838617146, +0.231574118), (+0.364681542, +0.140128493)
711call setShuffled(array)
712array
713(+0.838617146, +0.231574118), (+0.373916984, +0.348259628), (+0.496494353, +0.477706015), (+0.406593084E-1, +0.188141584), (+0.867605209E-3, +0.268216252), (+0.645414293, +0.697404981), (+0.182938874, +0.642279983E-1), (+0.111836314, +0.924725294), (+0.428317308, +0.116203010), (+0.364681542, +0.140128493)
714
715count = getUnifRand(0, size(array))
716count
717+3
718call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
719array
720(+0.496494353, +0.477706015), (+0.182938874, +0.642279983E-1), (+0.373916984, +0.348259628), (+0.406593084E-1, +0.188141584), (+0.867605209E-3, +0.268216252), (+0.645414293, +0.697404981), (+0.838617146, +0.231574118), (+0.111836314, +0.924725294), (+0.428317308, +0.116203010), (+0.364681542, +0.140128493)
721
722count = getUnifRand(4, 10)
723array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
724array
725(+0.216985762, +0.581071258), (+0.712639630, +0.761598647), (+0.993399739, +0.901484966), (+0.680132151, +0.884062767)
726call setShuffled(array)
727array
728(+0.712639630, +0.761598647), (+0.216985762, +0.581071258), (+0.680132151, +0.884062767), (+0.993399739, +0.901484966)
729
730count = getUnifRand(0, size(array))
731count
732+2
733call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
734array
735(+0.712639630, +0.761598647), (+0.680132151, +0.884062767), (+0.216985762, +0.581071258), (+0.993399739, +0.901484966)
736
737count = getUnifRand(4, 10)
738array = getUnifRand((0., 0.), (1., 1.), count) ! generate random array for illustration.
739array
740(+0.123943746, +0.638541639), (+0.141469479, +0.388844252), (+0.980723083, +0.422642887), (+0.103278935, +0.946757019), (+0.459997773, +0.445152342), (+0.882296562, +0.513571441), (+0.428909063E-1, +0.665532947)
741call setShuffled(array)
742array
743(+0.428909063E-1, +0.665532947), (+0.141469479, +0.388844252), (+0.459997773, +0.445152342), (+0.980723083, +0.422642887), (+0.882296562, +0.513571441), (+0.103278935, +0.946757019), (+0.123943746, +0.638541639)
744
745count = getUnifRand(0, size(array))
746count
747+7
748call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
749array
750(+0.428909063E-1, +0.665532947), (+0.882296562, +0.513571441), (+0.459997773, +0.445152342), (+0.980723083, +0.422642887), (+0.141469479, +0.388844252), (+0.103278935, +0.946757019), (+0.123943746, +0.638541639)
751
752count = getUnifRand(4, 10)
753array = getUnifRand(0., 1., count) ! generate random array for illustration.
754array
755+0.969736755, +0.531140506, +0.155511737, +0.331866026, +0.948817015, +0.713017642, +0.711267650, +0.859388471
756call setShuffled(array)
757array
758+0.155511737, +0.948817015, +0.531140506, +0.969736755, +0.859388471, +0.711267650, +0.331866026, +0.713017642
759
760count = getUnifRand(0, size(array))
761count
762+0
763call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
764array
765+0.155511737, +0.948817015, +0.531140506, +0.969736755, +0.859388471, +0.711267650, +0.331866026, +0.713017642
766
767count = getUnifRand(4, 10)
768array = getUnifRand(0., 1., count) ! generate random array for illustration.
769array
770+0.178954601E-1, +0.276965439, +0.282427669E-1, +0.959265232E-2, +0.642455339, +0.742335021, +0.811872184, +0.997578681, +0.777013302E-1
771call setShuffled(array)
772array
773+0.282427669E-1, +0.276965439, +0.642455339, +0.178954601E-1, +0.742335021, +0.811872184, +0.959265232E-2, +0.777013302E-1, +0.997578681
774
775count = getUnifRand(0, size(array))
776count
777+6
778call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
779array
780+0.777013302E-1, +0.997578681, +0.276965439, +0.742335021, +0.959265232E-2, +0.178954601E-1, +0.811872184, +0.282427669E-1, +0.642455339
781
782count = getUnifRand(4, 10)
783array = getUnifRand(0., 1., count) ! generate random array for illustration.
784array
785+0.140242577E-1, +0.101570904, +0.106773555, +0.108435452
786call setShuffled(array)
787array
788+0.140242577E-1, +0.106773555, +0.108435452, +0.101570904
789
790count = getUnifRand(0, size(array))
791count
792+0
793call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
794array
795+0.140242577E-1, +0.106773555, +0.108435452, +0.101570904
796
797count = getUnifRand(4, 10)
798array = getUnifRand(0., 1., count) ! generate random array for illustration.
799array
800+0.887103677, +0.446813166, +0.229054630, +0.458599329, +0.252680004
801call setShuffled(array)
802array
803+0.229054630, +0.458599329, +0.446813166, +0.887103677, +0.252680004
804
805count = getUnifRand(0, size(array))
806count
807+3
808call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
809array
810+0.887103677, +0.458599329, +0.229054630, +0.446813166, +0.252680004
811
812count = getUnifRand(4, 10)
813array = getUnifRand(0., 1., count) ! generate random array for illustration.
814array
815+0.849950314E-1, +0.372414291, +0.858538985, +0.656239510, +0.973330319, +0.168119907, +0.993717790
816call setShuffled(array)
817array
818+0.372414291, +0.849950314E-1, +0.656239510, +0.993717790, +0.168119907, +0.973330319, +0.858538985
819
820count = getUnifRand(0, size(array))
821count
822+1
823call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
824array
825+0.993717790, +0.849950314E-1, +0.656239510, +0.372414291, +0.168119907, +0.973330319, +0.858538985
826
827count = getUnifRand(4, 10)
828array = getUnifRand(0., 1., count) ! generate random array for illustration.
829array
830+0.434121013, +0.523052812, +0.361870527E-1, +0.825705111, +0.392718792
831call setShuffled(array)
832array
833+0.361870527E-1, +0.523052812, +0.392718792, +0.434121013, +0.825705111
834
835count = getUnifRand(0, size(array))
836count
837+0
838call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
839array
840+0.361870527E-1, +0.523052812, +0.392718792, +0.434121013, +0.825705111
841
842count = getUnifRand(4, 10)
843array = getUnifRand(0., 1., count) ! generate random array for illustration.
844array
845+0.412757397, +0.786342740, +0.254138708E-1, +0.573277295, +0.885917902, +0.745877981, +0.327985168, +0.717836618
846call setShuffled(array)
847array
848+0.327985168, +0.717836618, +0.573277295, +0.745877981, +0.254138708E-1, +0.786342740, +0.885917902, +0.412757397
849
850count = getUnifRand(0, size(array))
851count
852+6
853call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
854array
855+0.573277295, +0.717836618, +0.412757397, +0.745877981, +0.786342740, +0.885917902, +0.254138708E-1, +0.327985168
856
857count = getUnifRand(4, 10)
858array = getUnifRand(0., 1., count) ! generate random array for illustration.
859array
860+0.155439377E-1, +0.832366467, +0.141575992, +0.534395039, +0.560551941, +0.185489416, +0.228192389, +0.513671815
861call setShuffled(array)
862array
863+0.141575992, +0.185489416, +0.228192389, +0.832366467, +0.560551941, +0.155439377E-1, +0.534395039, +0.513671815
864
865count = getUnifRand(0, size(array))
866count
867+0
868call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
869array
870+0.141575992, +0.185489416, +0.228192389, +0.832366467, +0.560551941, +0.155439377E-1, +0.534395039, +0.513671815
871
872count = getUnifRand(4, 10)
873array = getUnifRand(0., 1., count) ! generate random array for illustration.
874array
875+0.720875978, +0.221396565, +0.591203809, +0.655384243, +0.874543846, +0.688803792, +0.265035570, +0.161422074, +0.474797249, +0.764096737
876call setShuffled(array)
877array
878+0.655384243, +0.474797249, +0.720875978, +0.874543846, +0.591203809, +0.764096737, +0.688803792, +0.265035570, +0.161422074, +0.221396565
879
880count = getUnifRand(0, size(array))
881count
882+1
883call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
884array
885+0.474797249, +0.655384243, +0.720875978, +0.874543846, +0.591203809, +0.764096737, +0.688803792, +0.265035570, +0.161422074, +0.221396565
886
887count = getUnifRand(4, 10)
888array = getUnifRand(0., 1., count) ! generate random array for illustration.
889array
890+0.952394843, +0.809370458, +0.745079339, +0.950896740E-1
891call setShuffled(array)
892array
893+0.952394843, +0.745079339, +0.809370458, +0.950896740E-1
894
895count = getUnifRand(0, size(array))
896count
897+0
898call setShuffled(array, count) ! draw randomly only `count` elements without replacement.
899array
900+0.952394843, +0.745079339, +0.809370458, +0.950896740E-1
901
Test:
test_pm_arrayShuffle
Todo:
Low Priority: This generic interface can be extended to 2D input objects.
Todo:
High Priority: Update 2021: This task is now resolved.
The current random integer generator uses a simple double precision real conversion to integer values.
While this works fairly well for most use cases, it may biased for generating random integer of kind IK4.
A future remedy should use Bitmask with Rejection as described here.
As of 2021, the use of double precision (64-bit) vs. single-precision for random number generation increases the computational cost of the algorithms by about three times.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin

Definition at line 688 of file pm_arrayShuffle.F90.


The documentation for this interface was generated from the following file: