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

Select a single (or multiple) element(s) from the input array of intrinsic type of arbitrary kind randomly uniformly or optionally according to the specified Probability Mass Function (PMF) of the input array.
More...

Detailed Description

Select a single (or multiple) element(s) from the input array of intrinsic type of arbitrary kind randomly uniformly or optionally according to the specified Probability Mass Function (PMF) of the input array.

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.
[out]choice: The output scalar or vector of the same type and kind as the input array whose value is randomly selected from the elements of array.
[in]array: The input contiguous array of non-zero size of shape (:) of either
  1. type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU), or
  2. type logical of kind any supported by the processor (e.g., LK), or
  3. type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64), or
  4. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128), or
  5. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
or a scalar of,
  1. type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of non-zero length,
  2. type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64) of non-zero value,
whose element(s) will be selected randomly and returned in the output choice.
The input array must be of non-zero length or size (unless it is a scalar non-negative integer of arbitrary kind).
[in]unique: The input scalar logical of default kind LK.
If .true., the elements of the output choice will be uniquely selected from the input array.
If .true., the size/length of the output choice must be larger than or equal to the size/length of the input array, otherwise, unique selection impossible.
(optional, default = .false._LK. It can be present if and only if the input argument is array-like (i.e., either scalar character or vector).)


Possible calling interfaces

call setChoice(rng, choice, array) ! `choice` is a scalar.
call setChoice(rng, choice, array, unique = unique) ! `choice` is array-like (sliceable, e.g., vector, or a scalar `character`) and longer than or equal-length to `array`.
!
Select a single (or multiple) element(s) from the input array of intrinsic type of arbitrary kind ran...
This module contains procedures and generic interfaces for selecting uniformly-distributed or arbitra...
Warning
The condition 0 < size(array) for non-character input array or 0 < len(array) for character input array must hold.
The condition len(choice) == len(array) for an input choice vector of character must hold.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
See also
isHead
getChange
setChange
getChoice
setChoice
getUnifRand
setUnifRand
getShuffled
setShuffled
getRemapped
setRemapped


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_arrayRange, only: getRange
10 use pm_distUnif, only: getUnifRand
11 use pm_arrayResize, only: setResized
14
15 implicit none
16
17 type(display_type) :: disp
18 integer(IK) :: count, itry, ntry = 10
19 type(xoshiro256ssw_type) :: rng
20 disp = display_type(file = "main.out.F90")
21 rng = xoshiro256ssw_type()
22
23 block
24 character(:), allocatable :: choice, array
25 do itry = 1, ntry
26
27 call disp%skip
28 call disp%show("count = getUnifRand(4, 10)")
29 count = getUnifRand(4, 10)
30 call disp%show("array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.")
31 array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
32 call disp%show("array")
33 call disp%show( array, deliml = SK_"""" )
34 call disp%show("call setResized(choice, 1)")
35 call setResized(choice, 1)
36 call disp%show("call setChoice(rng, choice, array)")
37 call setChoice(rng, choice, array)
38 call disp%show("choice")
39 call disp%show( choice, deliml = SK_"""" )
40 call disp%show("count = getUnifRand(1, 2 * len(array))")
41 count = getUnifRand(1, 2 * len(array))
42 call disp%show("count")
43 call disp%show( count )
44 call disp%show("call setResized(choice, count)")
45 call setResized(choice, count)
46 call disp%show("call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.")
47 call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
48 call disp%show("choice")
49 call disp%show( choice, deliml = SK_"""" )
50 call disp%show("count = getUnifRand(1, len(array))")
51 count = getUnifRand(1, len(array))
52 call disp%show("count")
53 call disp%show( count )
54 call disp%show("call setResized(choice, count)")
55 call setResized(choice, count)
56 call disp%show("call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
57 call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
58 call disp%show("choice")
59 call disp%show( choice, deliml = SK_"""" )
60
61 end do
62 end block
63
64 block
65 character(2), allocatable :: choice(:), array(:)
66 do itry = 1, ntry
67
68 call disp%skip
69 call disp%show("count = getUnifRand(4, 10)")
70 count = getUnifRand(4, 10)
71 call disp%show("array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.")
72 array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
73 call disp%show("array")
74 call disp%show( array, deliml = SK_"""" )
75 call disp%show("call setResized(choice, 1)")
76 call setResized(choice, 1)
77 call disp%show("choice = [getChoice(array)]")
78 choice = [getChoice(array)]
79 call disp%show("choice")
80 call disp%show( choice, deliml = SK_"""" )
81 call disp%show("count = getUnifRand(1, len(array))")
82 count = getUnifRand(1, len(array))
83 call disp%show("count")
84 call disp%show( count )
85 call disp%show("call setResized(choice, count)")
86 call setResized(choice, count)
87 call disp%show("call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.")
88 call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
89 call disp%show("choice")
90 call disp%show( choice, deliml = SK_"""" )
91 call disp%show("count = getUnifRand(1, size(array))")
92 count = getUnifRand(1, size(array))
93 call disp%show("count")
94 call disp%show( count )
95 call disp%show("call setResized(choice, count)")
96 call setResized(choice, count)
97 call disp%show("call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
98 call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
99 call disp%show("choice")
100 call disp%show( choice, deliml = SK_"""" )
101
102 end do
103 end block
104
105 block
106 integer, allocatable :: choice(:), array(:)
107 do itry = 1, ntry
108
109 call disp%skip
110 call disp%show("array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.")
111 array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
112 call disp%show("array")
113 call disp%show( array )
114 call disp%show("call setResized(choice, 1)")
115 call setResized(choice, 1)
116 call disp%show("choice = [getChoice(array)]")
117 choice = [getChoice(array)]
118 call disp%show("choice")
119 call disp%show( choice )
120 call disp%show("count = getUnifRand(1, 2 * size(array))")
121 count = getUnifRand(1, 2 * size(array))
122 call disp%show("count")
123 call disp%show( count )
124 call disp%show("call setResized(choice, count)")
125 call setResized(choice, count)
126 call disp%show("call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.")
127 call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
128 call disp%show("choice")
129 call disp%show( choice )
130 call disp%show("count = getUnifRand(1, size(array))")
131 count = getUnifRand(1, size(array))
132 call disp%show("count")
133 call disp%show( count )
134 call disp%show("call setResized(choice, count)")
135 call setResized(choice, count)
136 call disp%show("call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
137 call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
138 call disp%show("choice")
139 call disp%show( choice )
140
141 end do
142 end block
143
144 block
145 logical, allocatable :: choice(:), array(:)
146 do itry = 1, ntry
147
148 call disp%skip
149 call disp%show("array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.")
150 array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
151 call disp%show("array")
152 call disp%show( array )
153 call disp%show("call setResized(choice, 1)")
154 call setResized(choice, 1)
155 call disp%show("choice = [getChoice(array)]")
156 choice = [getChoice(array)]
157 call disp%show("choice")
158 call disp%show( choice )
159 call disp%show("count = getUnifRand(1, 2 * size(array))")
160 count = getUnifRand(1, 2 * size(array))
161 call disp%show("count")
162 call disp%show( count )
163 call disp%show("call setResized(choice, count)")
164 call setResized(choice, count)
165 call disp%show("call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.")
166 call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
167 call disp%show("choice")
168 call disp%show( choice )
169 call disp%show("count = getUnifRand(1, size(array))")
170 count = getUnifRand(1, size(array))
171 call disp%show("count")
172 call disp%show( count )
173 call disp%show("call setResized(choice, count)")
174 call setResized(choice, count)
175 call disp%show("call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
176 call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
177 call disp%show("choice")
178 call disp%show( choice )
179
180 end do
181 end block
182
183 block
184 complex, allocatable :: choice(:), array(:)
185 do itry = 1, ntry
186
187 call disp%skip
188 call disp%show("array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.")
189 array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
190 call disp%show("array")
191 call disp%show( array )
192 call disp%show("call setResized(choice, 1)")
193 call setResized(choice, 1)
194 call disp%show("choice = [getChoice(array)]")
195 choice = [getChoice(array)]
196 call disp%show("choice")
197 call disp%show( choice )
198 call disp%show("count = getUnifRand(1, 2 * size(array))")
199 count = getUnifRand(1, 2 * size(array))
200 call disp%show("count")
201 call disp%show( count )
202 call disp%show("call setResized(choice, count)")
203 call setResized(choice, count)
204 call disp%show("call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.")
205 call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
206 call disp%show("choice")
207 call disp%show( choice )
208 call disp%show("count = getUnifRand(1, size(array))")
209 count = getUnifRand(1, size(array))
210 call disp%show("count")
211 call disp%show( count )
212 call disp%show("call setResized(choice, count)")
213 call setResized(choice, count)
214 call disp%show("call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
215 call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
216 call disp%show("choice")
217 call disp%show( choice )
218
219 end do
220 end block
221
222 block
223 real, allocatable :: choice(:), array(:)
224 do itry = 1, ntry
225
226 call disp%skip
227 call disp%show("array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.")
228 array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
229 call disp%show("array")
230 call disp%show( array )
231 call disp%show("call setResized(choice, 1)")
232 call setResized(choice, 1)
233 call disp%show("choice = [getChoice(array)]")
234 choice = [getChoice(array)]
235 call disp%show("choice")
236 call disp%show( choice )
237 call disp%show("count = getUnifRand(1, 2 * size(array))")
238 count = getUnifRand(1, 2 * size(array))
239 call disp%show("count")
240 call disp%show( count )
241 call disp%show("call setResized(choice, count)")
242 call setResized(choice, count)
243 call disp%show("call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.")
244 call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
245 call disp%show("choice")
246 call disp%show( choice )
247 call disp%show("count = getUnifRand(1, size(array))")
248 count = getUnifRand(1, size(array))
249 call disp%show("count")
250 call disp%show( count )
251 call disp%show("call setResized(choice, count)")
252 call setResized(choice, count)
253 call disp%show("call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
254 call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
255 call disp%show("choice")
256 call disp%show( choice )
257
258 end do
259 end block
260
261end program example
Select a single (or multiple) element(s) from the input array of intrinsic type of arbitrary kind ran...
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
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 procedures and generic interfaces for generating ranges of discrete character,...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
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
This is the derived type for declaring and generating objects of type xoshiro256ssw_type containing a...
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"NCWZRN"
6call setResized(choice, 1)
7call setChoice(rng, choice, array)
8choice
9"Z"
10count = getUnifRand(1, 2 * len(array))
11count
12+4
13call setResized(choice, count)
14call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
15choice
16"WNNC"
17count = getUnifRand(1, len(array))
18count
19+2
20call setResized(choice, count)
21call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
22choice
23"RZ"
24
25count = getUnifRand(4, 10)
26array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
27array
28"QZUVGWQ"
29call setResized(choice, 1)
30call setChoice(rng, choice, array)
31choice
32"W"
33count = getUnifRand(1, 2 * len(array))
34count
35+8
36call setResized(choice, count)
37call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
38choice
39"UQUQZQVQ"
40count = getUnifRand(1, len(array))
41count
42+4
43call setResized(choice, count)
44call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
45choice
46"GQQW"
47
48count = getUnifRand(4, 10)
49array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
50array
51"PCPDMOKJ"
52call setResized(choice, 1)
53call setChoice(rng, choice, array)
54choice
55"D"
56count = getUnifRand(1, 2 * len(array))
57count
58+5
59call setResized(choice, count)
60call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
61choice
62"COOMJ"
63count = getUnifRand(1, len(array))
64count
65+3
66call setResized(choice, count)
67call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
68choice
69"PCO"
70
71count = getUnifRand(4, 10)
72array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
73array
74"MEBDAXNIA"
75call setResized(choice, 1)
76call setChoice(rng, choice, array)
77choice
78"X"
79count = getUnifRand(1, 2 * len(array))
80count
81+4
82call setResized(choice, count)
83call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
84choice
85"ANMM"
86count = getUnifRand(1, len(array))
87count
88+9
89call setResized(choice, count)
90call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
91choice
92"XMAAEIBND"
93
94count = getUnifRand(4, 10)
95array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
96array
97"VILWPXJ"
98call setResized(choice, 1)
99call setChoice(rng, choice, array)
100choice
101"J"
102count = getUnifRand(1, 2 * len(array))
103count
104+2
105call setResized(choice, count)
106call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
107choice
108"JP"
109count = getUnifRand(1, len(array))
110count
111+2
112call setResized(choice, count)
113call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
114choice
115"PI"
116
117count = getUnifRand(4, 10)
118array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
119array
120"IGNESMJ"
121call setResized(choice, 1)
122call setChoice(rng, choice, array)
123choice
124"J"
125count = getUnifRand(1, 2 * len(array))
126count
127+14
128call setResized(choice, count)
129call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
130choice
131"GEIIGNGSMIIIGE"
132count = getUnifRand(1, len(array))
133count
134+1
135call setResized(choice, count)
136call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
137choice
138"G"
139
140count = getUnifRand(4, 10)
141array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
142array
143"OGKPT"
144call setResized(choice, 1)
145call setChoice(rng, choice, array)
146choice
147"T"
148count = getUnifRand(1, 2 * len(array))
149count
150+3
151call setResized(choice, count)
152call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
153choice
154"GPG"
155count = getUnifRand(1, len(array))
156count
157+1
158call setResized(choice, count)
159call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
160choice
161"G"
162
163count = getUnifRand(4, 10)
164array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
165array
166"RTUKPOI"
167call setResized(choice, 1)
168call setChoice(rng, choice, array)
169choice
170"K"
171count = getUnifRand(1, 2 * len(array))
172count
173+13
174call setResized(choice, count)
175call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
176choice
177"IRTRRPIKPRRUK"
178count = getUnifRand(1, len(array))
179count
180+7
181call setResized(choice, count)
182call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
183choice
184"OUIPRKT"
185
186count = getUnifRand(4, 10)
187array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
188array
189"IUTHBLG"
190call setResized(choice, 1)
191call setChoice(rng, choice, array)
192choice
193"I"
194count = getUnifRand(1, 2 * len(array))
195count
196+6
197call setResized(choice, count)
198call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
199choice
200"GIHUHI"
201count = getUnifRand(1, len(array))
202count
203+5
204call setResized(choice, count)
205call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
206choice
207"HILBT"
208
209count = getUnifRand(4, 10)
210array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
211array
212"VSDDYQ"
213call setResized(choice, 1)
214call setChoice(rng, choice, array)
215choice
216"Q"
217count = getUnifRand(1, 2 * len(array))
218count
219+5
220call setResized(choice, count)
221call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
222choice
223"YDDDD"
224count = getUnifRand(1, len(array))
225count
226+1
227call setResized(choice, count)
228call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
229choice
230"V"
231
232count = getUnifRand(4, 10)
233array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
234array
235"AB", "GH", "PT", "IG", "SI", "XH", "CZ", "ZY"
236call setResized(choice, 1)
237choice = [getChoice(array)]
238choice
239"AB"
240count = getUnifRand(1, len(array))
241count
242+2
243call setResized(choice, count)
244call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
245choice
246"PT", "GH"
247count = getUnifRand(1, size(array))
248count
249+5
250call setResized(choice, count)
251call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
252choice
253"XH", "PT", "CZ", "ZY", "AB"
254
255count = getUnifRand(4, 10)
256array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
257array
258"ZV", "II", "PA", "EG", "RI", "AY", "PG", "EX", "UF", "MK"
259call setResized(choice, 1)
260choice = [getChoice(array)]
261choice
262"AY"
263count = getUnifRand(1, len(array))
264count
265+1
266call setResized(choice, count)
267call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
268choice
269"PG"
270count = getUnifRand(1, size(array))
271count
272+8
273call setResized(choice, count)
274call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
275choice
276"EX", "PA", "EG", "PG", "MK", "II", "ZV", "RI"
277
278count = getUnifRand(4, 10)
279array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
280array
281"NH", "EQ", "VJ", "VQ"
282call setResized(choice, 1)
283choice = [getChoice(array)]
284choice
285"EQ"
286count = getUnifRand(1, len(array))
287count
288+2
289call setResized(choice, count)
290call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
291choice
292"EQ", "VQ"
293count = getUnifRand(1, size(array))
294count
295+1
296call setResized(choice, count)
297call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
298choice
299"VJ"
300
301count = getUnifRand(4, 10)
302array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
303array
304"SP", "LW", "EX", "BJ", "XZ", "SM", "IA", "XO"
305call setResized(choice, 1)
306choice = [getChoice(array)]
307choice
308"BJ"
309count = getUnifRand(1, len(array))
310count
311+1
312call setResized(choice, count)
313call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
314choice
315"SM"
316count = getUnifRand(1, size(array))
317count
318+6
319call setResized(choice, count)
320call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
321choice
322"BJ", "EX", "SP", "XO", "XZ", "IA"
323
324count = getUnifRand(4, 10)
325array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
326array
327"YT", "HR", "WP", "SN", "OH", "QW", "AU", "ND"
328call setResized(choice, 1)
329choice = [getChoice(array)]
330choice
331"HR"
332count = getUnifRand(1, len(array))
333count
334+2
335call setResized(choice, count)
336call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
337choice
338"AU", "HR"
339count = getUnifRand(1, size(array))
340count
341+3
342call setResized(choice, count)
343call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
344choice
345"OH", "QW", "AU"
346
347count = getUnifRand(4, 10)
348array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
349array
350"GG", "WM", "HV", "HT", "JN", "PM", "II", "AK"
351call setResized(choice, 1)
352choice = [getChoice(array)]
353choice
354"JN"
355count = getUnifRand(1, len(array))
356count
357+2
358call setResized(choice, count)
359call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
360choice
361"HT", "JN"
362count = getUnifRand(1, size(array))
363count
364+7
365call setResized(choice, count)
366call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
367choice
368"WM", "HV", "JN", "HT", "AK", "GG", "PM"
369
370count = getUnifRand(4, 10)
371array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
372array
373"HM", "ZP", "ZP", "RH", "OA", "BS", "XW", "YY", "FU"
374call setResized(choice, 1)
375choice = [getChoice(array)]
376choice
377"BS"
378count = getUnifRand(1, len(array))
379count
380+2
381call setResized(choice, count)
382call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
383choice
384"RH", "BS"
385count = getUnifRand(1, size(array))
386count
387+9
388call setResized(choice, count)
389call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
390choice
391"ZP", "OA", "ZP", "XW", "HM", "YY", "BS", "FU", "RH"
392
393count = getUnifRand(4, 10)
394array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
395array
396"WX", "NO", "TQ", "EA", "WT"
397call setResized(choice, 1)
398choice = [getChoice(array)]
399choice
400"WX"
401count = getUnifRand(1, len(array))
402count
403+2
404call setResized(choice, count)
405call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
406choice
407"NO", "NO"
408count = getUnifRand(1, size(array))
409count
410+4
411call setResized(choice, count)
412call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
413choice
414"TQ", "WX", "NO", "EA"
415
416count = getUnifRand(4, 10)
417array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
418array
419"CI", "OI", "DI", "IK", "HC", "TB", "IP", "WB", "LM"
420call setResized(choice, 1)
421choice = [getChoice(array)]
422choice
423"IK"
424count = getUnifRand(1, len(array))
425count
426+1
427call setResized(choice, count)
428call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
429choice
430"LM"
431count = getUnifRand(1, size(array))
432count
433+1
434call setResized(choice, count)
435call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
436choice
437"TB"
438
439count = getUnifRand(4, 10)
440array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
441array
442"HU", "PE", "CT", "KZ", "NW", "QN", "IO", "EY", "QY"
443call setResized(choice, 1)
444choice = [getChoice(array)]
445choice
446"HU"
447count = getUnifRand(1, len(array))
448count
449+2
450call setResized(choice, count)
451call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
452choice
453"NW", "CT"
454count = getUnifRand(1, size(array))
455count
456+1
457call setResized(choice, count)
458call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
459choice
460"QY"
461
462array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
463array
464+2, +7, +7, +5, +4, +20
465call setResized(choice, 1)
466choice = [getChoice(array)]
467choice
468+7
469count = getUnifRand(1, 2 * size(array))
470count
471+12
472call setResized(choice, count)
473call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
474choice
475+5, +20, +7, +20, +20, +5, +2, +20, +5, +7, +2, +7
476count = getUnifRand(1, size(array))
477count
478+2
479call setResized(choice, count)
480call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
481choice
482+4, +7
483
484array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
485array
486+6, +12, +19, +10, +16, +18, +10, +6
487call setResized(choice, 1)
488choice = [getChoice(array)]
489choice
490+12
491count = getUnifRand(1, 2 * size(array))
492count
493+12
494call setResized(choice, count)
495call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
496choice
497+12, +10, +16, +12, +12, +10, +10, +10, +18, +12, +19, +10
498count = getUnifRand(1, size(array))
499count
500+8
501call setResized(choice, count)
502call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
503choice
504+6, +18, +19, +10, +10, +12, +6, +16
505
506array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
507array
508+6, +9, +3, +11, +4, +2, +7
509call setResized(choice, 1)
510choice = [getChoice(array)]
511choice
512+2
513count = getUnifRand(1, 2 * size(array))
514count
515+7
516call setResized(choice, count)
517call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
518choice
519+3, +11, +2, +7, +3, +9, +9
520count = getUnifRand(1, size(array))
521count
522+2
523call setResized(choice, count)
524call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
525choice
526+2, +4
527
528array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
529array
530+3, +10, +14, +20
531call setResized(choice, 1)
532choice = [getChoice(array)]
533choice
534+3
535count = getUnifRand(1, 2 * size(array))
536count
537+1
538call setResized(choice, count)
539call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
540choice
541+20
542count = getUnifRand(1, size(array))
543count
544+2
545call setResized(choice, count)
546call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
547choice
548+20, +10
549
550array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
551array
552+10, +1, +11, +9, +16, +18, +5, +18
553call setResized(choice, 1)
554choice = [getChoice(array)]
555choice
556+18
557count = getUnifRand(1, 2 * size(array))
558count
559+4
560call setResized(choice, count)
561call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
562choice
563+1, +10, +5, +1
564count = getUnifRand(1, size(array))
565count
566+1
567call setResized(choice, count)
568call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
569choice
570+16
571
572array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
573array
574+11, +1, +13, +11, +1, +2, +13
575call setResized(choice, 1)
576choice = [getChoice(array)]
577choice
578+1
579count = getUnifRand(1, 2 * size(array))
580count
581+10
582call setResized(choice, count)
583call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
584choice
585+13, +11, +1, +13, +1, +11, +11, +13, +2, +13
586count = getUnifRand(1, size(array))
587count
588+6
589call setResized(choice, count)
590call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
591choice
592+2, +1, +13, +1, +11, +13
593
594array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
595array
596+6, +6, +18, +17, +4, +7, +7, +7, +2
597call setResized(choice, 1)
598choice = [getChoice(array)]
599choice
600+7
601count = getUnifRand(1, 2 * size(array))
602count
603+15
604call setResized(choice, count)
605call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
606choice
607+7, +7, +6, +7, +7, +6, +7, +7, +6, +4, +6, +17, +6, +18, +18
608count = getUnifRand(1, size(array))
609count
610+3
611call setResized(choice, count)
612call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
613choice
614+7, +2, +7
615
616array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
617array
618+2, +2, +1, +2, +12, +17
619call setResized(choice, 1)
620choice = [getChoice(array)]
621choice
622+2
623count = getUnifRand(1, 2 * size(array))
624count
625+8
626call setResized(choice, count)
627call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
628choice
629+1, +2, +1, +12, +17, +1, +1, +2
630count = getUnifRand(1, size(array))
631count
632+4
633call setResized(choice, count)
634call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
635choice
636+2, +1, +12, +17
637
638array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
639array
640+16, +2, +18, +10, +14
641call setResized(choice, 1)
642choice = [getChoice(array)]
643choice
644+2
645count = getUnifRand(1, 2 * size(array))
646count
647+4
648call setResized(choice, count)
649call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
650choice
651+16, +18, +16, +14
652count = getUnifRand(1, size(array))
653count
654+3
655call setResized(choice, count)
656call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
657choice
658+18, +16, +2
659
660array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
661array
662+17, +20, +17, +6, +17, +20, +5
663call setResized(choice, 1)
664choice = [getChoice(array)]
665choice
666+5
667count = getUnifRand(1, 2 * size(array))
668count
669+10
670call setResized(choice, count)
671call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
672choice
673+17, +20, +5, +17, +17, +20, +5, +20, +6, +6
674count = getUnifRand(1, size(array))
675count
676+4
677call setResized(choice, count)
678call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
679choice
680+17, +17, +6, +17
681
682array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
683array
684F, F, F, F, F, F
685call setResized(choice, 1)
686choice = [getChoice(array)]
687choice
688F
689count = getUnifRand(1, 2 * size(array))
690count
691+1
692call setResized(choice, count)
693call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
694choice
695F
696count = getUnifRand(1, size(array))
697count
698+4
699call setResized(choice, count)
700call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
701choice
702F, F, F, F
703
704array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
705array
706F, T, T, F, F
707call setResized(choice, 1)
708choice = [getChoice(array)]
709choice
710F
711count = getUnifRand(1, 2 * size(array))
712count
713+6
714call setResized(choice, count)
715call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
716choice
717F, T, F, F, F, T
718count = getUnifRand(1, size(array))
719count
720+3
721call setResized(choice, count)
722call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
723choice
724F, T, T
725
726array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
727array
728F, F, T, T, T, T
729call setResized(choice, 1)
730choice = [getChoice(array)]
731choice
732F
733count = getUnifRand(1, 2 * size(array))
734count
735+10
736call setResized(choice, count)
737call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
738choice
739T, T, F, F, F, T, F, T, T, T
740count = getUnifRand(1, size(array))
741count
742+6
743call setResized(choice, count)
744call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
745choice
746T, T, F, T, F, T
747
748array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
749array
750T, F, T, F, F, F, F, F, F, T
751call setResized(choice, 1)
752choice = [getChoice(array)]
753choice
754F
755count = getUnifRand(1, 2 * size(array))
756count
757+20
758call setResized(choice, count)
759call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
760choice
761F, T, F, T, F, F, T, F, T, T, F, F, F, F, T, T, F, T, T, F
762count = getUnifRand(1, size(array))
763count
764+3
765call setResized(choice, count)
766call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
767choice
768T, F, F
769
770array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
771array
772F, F, F, T, T, F, F, T, T, F
773call setResized(choice, 1)
774choice = [getChoice(array)]
775choice
776F
777count = getUnifRand(1, 2 * size(array))
778count
779+20
780call setResized(choice, count)
781call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
782choice
783F, F, F, F, T, F, F, T, T, T, F, T, F, F, F, T, T, F, F, T
784count = getUnifRand(1, size(array))
785count
786+4
787call setResized(choice, count)
788call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
789choice
790F, F, T, F
791
792array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
793array
794T, T, F, T, T, T, F
795call setResized(choice, 1)
796choice = [getChoice(array)]
797choice
798T
799count = getUnifRand(1, 2 * size(array))
800count
801+7
802call setResized(choice, count)
803call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
804choice
805T, T, F, T, F, T, T
806count = getUnifRand(1, size(array))
807count
808+2
809call setResized(choice, count)
810call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
811choice
812T, T
813
814array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
815array
816F, F, F, F, T, T
817call setResized(choice, 1)
818choice = [getChoice(array)]
819choice
820F
821count = getUnifRand(1, 2 * size(array))
822count
823+1
824call setResized(choice, count)
825call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
826choice
827F
828count = getUnifRand(1, size(array))
829count
830+2
831call setResized(choice, count)
832call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
833choice
834F, F
835
836array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
837array
838T, T, F, T, T, F, T
839call setResized(choice, 1)
840choice = [getChoice(array)]
841choice
842T
843count = getUnifRand(1, 2 * size(array))
844count
845+4
846call setResized(choice, count)
847call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
848choice
849T, T, T, T
850count = getUnifRand(1, size(array))
851count
852+4
853call setResized(choice, count)
854call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
855choice
856T, F, F, T
857
858array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
859array
860T, T, T, F, T, T
861call setResized(choice, 1)
862choice = [getChoice(array)]
863choice
864F
865count = getUnifRand(1, 2 * size(array))
866count
867+4
868call setResized(choice, count)
869call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
870choice
871T, F, T, T
872count = getUnifRand(1, size(array))
873count
874+4
875call setResized(choice, count)
876call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
877choice
878F, T, T, T
879
880array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
881array
882T, F, T, T, T, T, T, F, F
883call setResized(choice, 1)
884choice = [getChoice(array)]
885choice
886F
887count = getUnifRand(1, 2 * size(array))
888count
889+8
890call setResized(choice, count)
891call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
892choice
893F, F, F, T, T, T, T, T
894count = getUnifRand(1, size(array))
895count
896+8
897call setResized(choice, count)
898call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
899choice
900T, T, F, T, T, F, T, F
901
902array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
903array
904(+0.937458813, +0.756397903), (+0.320859075, +0.629977584E-1), (+0.898656130, +0.678015292), (+0.750891685, +0.709652543)
905call setResized(choice, 1)
906choice = [getChoice(array)]
907choice
908(+0.750891685, +0.709652543)
909count = getUnifRand(1, 2 * size(array))
910count
911+2
912call setResized(choice, count)
913call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
914choice
915(+0.898656130, +0.678015292), (+0.320859075, +0.629977584E-1)
916count = getUnifRand(1, size(array))
917count
918+1
919call setResized(choice, count)
920call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
921choice
922(+0.898656130, +0.678015292)
923
924array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
925array
926(+0.473775327, +0.625314534), (+0.437416553, +0.513441384), (+0.383132458, +0.417236686E-1), (+0.131232202, +0.474289298), (+0.563387752, +0.665079057)
927call setResized(choice, 1)
928choice = [getChoice(array)]
929choice
930(+0.437416553, +0.513441384)
931count = getUnifRand(1, 2 * size(array))
932count
933+1
934call setResized(choice, count)
935call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
936choice
937(+0.131232202, +0.474289298)
938count = getUnifRand(1, size(array))
939count
940+1
941call setResized(choice, count)
942call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
943choice
944(+0.437416553, +0.513441384)
945
946array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
947array
948(+0.234726965, +0.308639169), (+0.306983888, +0.882793248), (+0.250209987, +0.327901542), (+0.945302069, +0.470741749), (+0.729710042, +0.946335435), (+0.225798488, +0.878892004), (+0.512167990, +0.386979580), (+0.572929263, +0.494437873), (+0.737896264, +0.513718724E-1), (+0.860873401, +0.523610592)
949call setResized(choice, 1)
950choice = [getChoice(array)]
951choice
952(+0.512167990, +0.386979580)
953count = getUnifRand(1, 2 * size(array))
954count
955+15
956call setResized(choice, count)
957call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
958choice
959(+0.737896264, +0.513718724E-1), (+0.250209987, +0.327901542), (+0.729710042, +0.946335435), (+0.737896264, +0.513718724E-1), (+0.945302069, +0.470741749), (+0.234726965, +0.308639169), (+0.250209987, +0.327901542), (+0.512167990, +0.386979580), (+0.512167990, +0.386979580), (+0.729710042, +0.946335435), (+0.225798488, +0.878892004), (+0.234726965, +0.308639169), (+0.234726965, +0.308639169), (+0.737896264, +0.513718724E-1), (+0.250209987, +0.327901542)
960count = getUnifRand(1, size(array))
961count
962+9
963call setResized(choice, count)
964call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
965choice
966(+0.729710042, +0.946335435), (+0.512167990, +0.386979580), (+0.225798488, +0.878892004), (+0.250209987, +0.327901542), (+0.572929263, +0.494437873), (+0.737896264, +0.513718724E-1), (+0.860873401, +0.523610592), (+0.945302069, +0.470741749), (+0.234726965, +0.308639169)
967
968array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
969array
970(+0.992146730E-1, +0.365166783), (+0.500726402, +0.296405017), (+0.514988363, +0.712727427), (+0.789041579, +0.665909171), (+0.292304158, +0.313052773), (+0.905919015, +0.139571428), (+0.666543186, +0.569876134)
971call setResized(choice, 1)
972choice = [getChoice(array)]
973choice
974(+0.514988363, +0.712727427)
975count = getUnifRand(1, 2 * size(array))
976count
977+13
978call setResized(choice, count)
979call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
980choice
981(+0.292304158, +0.313052773), (+0.292304158, +0.313052773), (+0.992146730E-1, +0.365166783), (+0.292304158, +0.313052773), (+0.500726402, +0.296405017), (+0.905919015, +0.139571428), (+0.789041579, +0.665909171), (+0.905919015, +0.139571428), (+0.992146730E-1, +0.365166783), (+0.992146730E-1, +0.365166783), (+0.292304158, +0.313052773), (+0.905919015, +0.139571428), (+0.789041579, +0.665909171)
982count = getUnifRand(1, size(array))
983count
984+6
985call setResized(choice, count)
986call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
987choice
988(+0.292304158, +0.313052773), (+0.514988363, +0.712727427), (+0.666543186, +0.569876134), (+0.789041579, +0.665909171), (+0.905919015, +0.139571428), (+0.992146730E-1, +0.365166783)
989
990array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
991array
992(+0.910028815E-1, +0.552107692E-1), (+0.370464027, +0.342728317), (+0.949704051E-1, +0.919693291), (+0.201755166, +0.302372575), (+0.639482796, +0.654823244), (+0.792770505, +0.612674654), (+0.900882185, +0.640287459)
993call setResized(choice, 1)
994choice = [getChoice(array)]
995choice
996(+0.792770505, +0.612674654)
997count = getUnifRand(1, 2 * size(array))
998count
999+11
1000call setResized(choice, count)
1001call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1002choice
1003(+0.910028815E-1, +0.552107692E-1), (+0.900882185, +0.640287459), (+0.370464027, +0.342728317), (+0.201755166, +0.302372575), (+0.370464027, +0.342728317), (+0.949704051E-1, +0.919693291), (+0.370464027, +0.342728317), (+0.910028815E-1, +0.552107692E-1), (+0.900882185, +0.640287459), (+0.639482796, +0.654823244), (+0.370464027, +0.342728317)
1004count = getUnifRand(1, size(array))
1005count
1006+4
1007call setResized(choice, count)
1008call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1009choice
1010(+0.370464027, +0.342728317), (+0.910028815E-1, +0.552107692E-1), (+0.639482796, +0.654823244), (+0.201755166, +0.302372575)
1011
1012array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
1013array
1014(+0.552798510E-1, +0.982818186), (+0.225328803E-1, +0.877824605), (+0.164809763, +0.235496700), (+0.420533240, +0.449772418), (+0.399078131, +0.764916301)
1015call setResized(choice, 1)
1016choice = [getChoice(array)]
1017choice
1018(+0.552798510E-1, +0.982818186)
1019count = getUnifRand(1, 2 * size(array))
1020count
1021+7
1022call setResized(choice, count)
1023call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1024choice
1025(+0.552798510E-1, +0.982818186), (+0.420533240, +0.449772418), (+0.552798510E-1, +0.982818186), (+0.399078131, +0.764916301), (+0.164809763, +0.235496700), (+0.164809763, +0.235496700), (+0.399078131, +0.764916301)
1026count = getUnifRand(1, size(array))
1027count
1028+4
1029call setResized(choice, count)
1030call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1031choice
1032(+0.552798510E-1, +0.982818186), (+0.399078131, +0.764916301), (+0.420533240, +0.449772418), (+0.225328803E-1, +0.877824605)
1033
1034array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
1035array
1036(+0.641448021, +0.344491482), (+0.202381313, +0.960540891), (+0.752502680E-2, +0.771268070), (+0.518336773, +0.435299754), (+0.999830306, +0.863758922E-1), (+0.191473365E-1, +0.203864813), (+0.232761383, +0.359042346)
1037call setResized(choice, 1)
1038choice = [getChoice(array)]
1039choice
1040(+0.232761383, +0.359042346)
1041count = getUnifRand(1, 2 * size(array))
1042count
1043+6
1044call setResized(choice, count)
1045call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1046choice
1047(+0.641448021, +0.344491482), (+0.518336773, +0.435299754), (+0.752502680E-2, +0.771268070), (+0.752502680E-2, +0.771268070), (+0.518336773, +0.435299754), (+0.999830306, +0.863758922E-1)
1048count = getUnifRand(1, size(array))
1049count
1050+4
1051call setResized(choice, count)
1052call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1053choice
1054(+0.202381313, +0.960540891), (+0.191473365E-1, +0.203864813), (+0.232761383, +0.359042346), (+0.752502680E-2, +0.771268070)
1055
1056array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
1057array
1058(+0.720077753E-1, +0.606403410), (+0.901136756, +0.109365582E-1), (+0.192668736, +0.749378622), (+0.361306608, +0.273170054), (+0.932782412, +0.935008168), (+0.147872508, +0.266262770)
1059call setResized(choice, 1)
1060choice = [getChoice(array)]
1061choice
1062(+0.361306608, +0.273170054)
1063count = getUnifRand(1, 2 * size(array))
1064count
1065+6
1066call setResized(choice, count)
1067call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1068choice
1069(+0.192668736, +0.749378622), (+0.901136756, +0.109365582E-1), (+0.901136756, +0.109365582E-1), (+0.361306608, +0.273170054), (+0.361306608, +0.273170054), (+0.361306608, +0.273170054)
1070count = getUnifRand(1, size(array))
1071count
1072+4
1073call setResized(choice, count)
1074call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1075choice
1076(+0.147872508, +0.266262770), (+0.720077753E-1, +0.606403410), (+0.932782412, +0.935008168), (+0.901136756, +0.109365582E-1)
1077
1078array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
1079array
1080(+0.390623331, +0.517855287), (+0.804496527, +0.619407892), (+0.202350557, +0.204055011), (+0.372554898, +0.833916724), (+0.827386737, +0.843593597), (+0.877119660, +0.256763160)
1081call setResized(choice, 1)
1082choice = [getChoice(array)]
1083choice
1084(+0.804496527, +0.619407892)
1085count = getUnifRand(1, 2 * size(array))
1086count
1087+8
1088call setResized(choice, count)
1089call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1090choice
1091(+0.827386737, +0.843593597), (+0.372554898, +0.833916724), (+0.827386737, +0.843593597), (+0.390623331, +0.517855287), (+0.372554898, +0.833916724), (+0.877119660, +0.256763160), (+0.804496527, +0.619407892), (+0.202350557, +0.204055011)
1092count = getUnifRand(1, size(array))
1093count
1094+1
1095call setResized(choice, count)
1096call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1097choice
1098(+0.877119660, +0.256763160)
1099
1100array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
1101array
1102(+0.793661416, +0.182262361), (+0.216879010, +0.665483356), (+0.608515263, +0.265232801), (+0.850251615, +0.945150554), (+0.262750387E-1, +0.314729035)
1103call setResized(choice, 1)
1104choice = [getChoice(array)]
1105choice
1106(+0.262750387E-1, +0.314729035)
1107count = getUnifRand(1, 2 * size(array))
1108count
1109+9
1110call setResized(choice, count)
1111call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1112choice
1113(+0.608515263, +0.265232801), (+0.262750387E-1, +0.314729035), (+0.262750387E-1, +0.314729035), (+0.608515263, +0.265232801), (+0.262750387E-1, +0.314729035), (+0.216879010, +0.665483356), (+0.262750387E-1, +0.314729035), (+0.850251615, +0.945150554), (+0.262750387E-1, +0.314729035)
1114count = getUnifRand(1, size(array))
1115count
1116+1
1117call setResized(choice, count)
1118call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1119choice
1120(+0.216879010, +0.665483356)
1121
1122array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1123array
1124+0.987963676, +0.857400596, +0.756156445E-2, +0.682018220, +0.930471301
1125call setResized(choice, 1)
1126choice = [getChoice(array)]
1127choice
1128+0.756156445E-2
1129count = getUnifRand(1, 2 * size(array))
1130count
1131+4
1132call setResized(choice, count)
1133call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1134choice
1135+0.857400596, +0.756156445E-2, +0.930471301, +0.857400596
1136count = getUnifRand(1, size(array))
1137count
1138+5
1139call setResized(choice, count)
1140call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1141choice
1142+0.857400596, +0.756156445E-2, +0.682018220, +0.930471301, +0.987963676
1143
1144array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1145array
1146+0.349125922, +0.578513265, +0.408254266, +0.424543619E-1, +0.714842737, +0.888524055E-1, +0.966523468, +0.394186378E-1, +0.336788118, +0.515639842
1147call setResized(choice, 1)
1148choice = [getChoice(array)]
1149choice
1150+0.515639842
1151count = getUnifRand(1, 2 * size(array))
1152count
1153+14
1154call setResized(choice, count)
1155call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1156choice
1157+0.888524055E-1, +0.349125922, +0.349125922, +0.349125922, +0.424543619E-1, +0.408254266, +0.394186378E-1, +0.966523468, +0.888524055E-1, +0.966523468, +0.966523468, +0.424543619E-1, +0.424543619E-1, +0.515639842
1158count = getUnifRand(1, size(array))
1159count
1160+6
1161call setResized(choice, count)
1162call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1163choice
1164+0.424543619E-1, +0.966523468, +0.394186378E-1, +0.349125922, +0.408254266, +0.515639842
1165
1166array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1167array
1168+0.840398431, +0.439279616, +0.150415897E-1, +0.332450032, +0.403473675, +0.444231629E-1, +0.289152861E-1, +0.204868019, +0.283653200
1169call setResized(choice, 1)
1170choice = [getChoice(array)]
1171choice
1172+0.332450032
1173count = getUnifRand(1, 2 * size(array))
1174count
1175+7
1176call setResized(choice, count)
1177call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1178choice
1179+0.403473675, +0.332450032, +0.439279616, +0.439279616, +0.444231629E-1, +0.444231629E-1, +0.283653200
1180count = getUnifRand(1, size(array))
1181count
1182+2
1183call setResized(choice, count)
1184call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1185choice
1186+0.283653200, +0.403473675
1187
1188array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1189array
1190+0.921697557, +0.215926051, +0.586116672, +0.393611491, +0.774977982, +0.743694782, +0.722949028
1191call setResized(choice, 1)
1192choice = [getChoice(array)]
1193choice
1194+0.774977982
1195count = getUnifRand(1, 2 * size(array))
1196count
1197+12
1198call setResized(choice, count)
1199call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1200choice
1201+0.921697557, +0.743694782, +0.586116672, +0.215926051, +0.722949028, +0.393611491, +0.743694782, +0.774977982, +0.215926051, +0.722949028, +0.774977982, +0.393611491
1202count = getUnifRand(1, size(array))
1203count
1204+1
1205call setResized(choice, count)
1206call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1207choice
1208+0.215926051
1209
1210array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1211array
1212+0.650941133, +0.719946623E-2, +0.786774337, +0.639983118, +0.820037603, +0.791256905, +0.114024162
1213call setResized(choice, 1)
1214choice = [getChoice(array)]
1215choice
1216+0.639983118
1217count = getUnifRand(1, 2 * size(array))
1218count
1219+1
1220call setResized(choice, count)
1221call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1222choice
1223+0.650941133
1224count = getUnifRand(1, size(array))
1225count
1226+4
1227call setResized(choice, count)
1228call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1229choice
1230+0.820037603, +0.650941133, +0.114024162, +0.786774337
1231
1232array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1233array
1234+0.588709712, +0.675942063, +0.743193448, +0.780259252, +0.413160622
1235call setResized(choice, 1)
1236choice = [getChoice(array)]
1237choice
1238+0.780259252
1239count = getUnifRand(1, 2 * size(array))
1240count
1241+8
1242call setResized(choice, count)
1243call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1244choice
1245+0.780259252, +0.588709712, +0.413160622, +0.675942063, +0.743193448, +0.413160622, +0.413160622, +0.675942063
1246count = getUnifRand(1, size(array))
1247count
1248+1
1249call setResized(choice, count)
1250call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1251choice
1252+0.413160622
1253
1254array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1255array
1256+0.916391492, +0.672937691, +0.508604407, +0.832278430, +0.542627573E-1, +0.181859851, +0.890420318, +0.413105488
1257call setResized(choice, 1)
1258choice = [getChoice(array)]
1259choice
1260+0.542627573E-1
1261count = getUnifRand(1, 2 * size(array))
1262count
1263+14
1264call setResized(choice, count)
1265call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1266choice
1267+0.832278430, +0.672937691, +0.542627573E-1, +0.508604407, +0.916391492, +0.508604407, +0.413105488, +0.672937691, +0.832278430, +0.890420318, +0.916391492, +0.672937691, +0.413105488, +0.890420318
1268count = getUnifRand(1, size(array))
1269count
1270+5
1271call setResized(choice, count)
1272call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1273choice
1274+0.542627573E-1, +0.832278430, +0.672937691, +0.916391492, +0.508604407
1275
1276array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1277array
1278+0.683466196E-1, +0.180370867, +0.541683376, +0.447448134, +0.188439310, +0.467945695
1279call setResized(choice, 1)
1280choice = [getChoice(array)]
1281choice
1282+0.447448134
1283count = getUnifRand(1, 2 * size(array))
1284count
1285+12
1286call setResized(choice, count)
1287call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1288choice
1289+0.188439310, +0.188439310, +0.541683376, +0.541683376, +0.467945695, +0.447448134, +0.188439310, +0.180370867, +0.683466196E-1, +0.447448134, +0.467945695, +0.683466196E-1
1290count = getUnifRand(1, size(array))
1291count
1292+4
1293call setResized(choice, count)
1294call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1295choice
1296+0.188439310, +0.180370867, +0.541683376, +0.683466196E-1
1297
1298array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1299array
1300+0.250257909, +0.509391308, +0.638519228, +0.949704528, +0.245891213E-1, +0.653243780
1301call setResized(choice, 1)
1302choice = [getChoice(array)]
1303choice
1304+0.638519228
1305count = getUnifRand(1, 2 * size(array))
1306count
1307+12
1308call setResized(choice, count)
1309call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1310choice
1311+0.638519228, +0.250257909, +0.949704528, +0.638519228, +0.653243780, +0.653243780, +0.509391308, +0.245891213E-1, +0.949704528, +0.509391308, +0.949704528, +0.250257909
1312count = getUnifRand(1, size(array))
1313count
1314+1
1315call setResized(choice, count)
1316call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1317choice
1318+0.653243780
1319
1320array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
1321array
1322+0.663643539, +0.192906380, +0.483549774, +0.175579906
1323call setResized(choice, 1)
1324choice = [getChoice(array)]
1325choice
1326+0.192906380
1327count = getUnifRand(1, 2 * size(array))
1328count
1329+4
1330call setResized(choice, count)
1331call setChoice(rng, choice, array) ! draw randomly only `count` elements with replacement.
1332choice
1333+0.175579906, +0.483549774, +0.192906380, +0.483549774
1334count = getUnifRand(1, size(array))
1335count
1336+4
1337call setResized(choice, count)
1338call setChoice(rng, choice, array, unique = .true._LK) ! draw randomly only `count` elements without replacement.
1339choice
1340+0.663643539, +0.175579906, +0.483549774, +0.192906380
1341


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, Monday March 6, 2017, 3:22 pm, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin.

Definition at line 987 of file pm_arrayChoice.F90.


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