ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_arrayChoice::getChoice 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]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]s1: The input non-negative scalar integer of default kind IK, representing the number of output choices (i.e., elements selected from the input array).
(optional. If missing, the output is a scalar (of rank 0).)
[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.
(optional, default = .false._LK. It can be present if and only if the input argument s1 is also present.)
Returns
choice : The output object of the same type and kind as the input array whose value is randomly selected from the elements of array.
  1. It is a scalar (of rank 0, or a scalar character of length 1) if the input argument s1 is missing.
  2. It is an array of size s1 (or a scalar character of length s1) if the input argument s1 is present.


Possible calling interfaces

choice = getChoice(array)
choice(1:s1) = getChoice(array, s1, unique = unique)
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.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
Remarks
The procedures under this generic interface provide only a convenient functional interface to random choices.
For high performance applications, use the subroutine interface setChoice.
Developer Remark:
The choice of the input argument name s1 is deliberate to allow future expansion of the interface to output choice of higher rank than 1.
Warning
The condition 0 < size(array) for non-character input array or 0 < len(array) for character input array must hold.
The condition 0 < size(choice) for non-character input choice or 0 < len(choice) for character input choice 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_arrayChoice, only: getChoice
12
13 implicit none
14
15 integer(IK) :: count, itry, ntry = 10
16 type(display_type) :: disp
17 disp = display_type(file = "main.out.F90")
18
19 block
20 character(:), allocatable :: choice, array
21 do itry = 1, ntry
22
23 call disp%skip
24 call disp%show("count = getUnifRand(4, 10)")
25 count = getUnifRand(4, 10)
26 call disp%show("array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.")
27 array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
28 call disp%show("array")
29 call disp%show( array, deliml = SK_"""" )
30 call disp%show("choice = getChoice(array)")
31 choice = getChoice(array)
32 call disp%show("choice")
33 call disp%show( choice, deliml = SK_"""" )
34 call disp%show("count = getUnifRand(1, len(array))")
35 count = getUnifRand(1, len(array))
36 call disp%show("count")
37 call disp%show( count )
38 call disp%show("choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.")
39 choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
40 call disp%show("choice")
41 call disp%show( choice, deliml = SK_"""" )
42 call disp%show("choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
43 choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
44 call disp%show("choice")
45 call disp%show( choice, deliml = SK_"""" )
46
47 end do
48 end block
49
50 block
51 character(2), allocatable :: choice(:), array(:)
52 do itry = 1, ntry
53
54 call disp%skip
55 call disp%show("count = getUnifRand(4, 10)")
56 count = getUnifRand(4, 10)
57 call disp%show("array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.")
58 array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
59 call disp%show("array")
60 call disp%show( array, deliml = SK_"""" )
61 call disp%show("choice = [getChoice(array)]")
62 choice = [getChoice(array)]
63 call disp%show("choice")
64 call disp%show( choice, deliml = SK_"""" )
65 call disp%show("count = getUnifRand(1, len(array))")
66 count = getUnifRand(1, len(array))
67 call disp%show("count")
68 call disp%show( count )
69 call disp%show("choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.")
70 choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
71 call disp%show("choice")
72 call disp%show( choice, deliml = SK_"""" )
73 call disp%show("choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
74 choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
75 call disp%show("choice")
76 call disp%show( choice, deliml = SK_"""" )
77
78 end do
79 end block
80
81 block
82 integer, allocatable :: choice(:), array(:)
83 do itry = 1, ntry
84
85 call disp%skip
86 call disp%show("array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.")
87 array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
88 call disp%show("array")
89 call disp%show( array )
90 call disp%show("choice = [getChoice(array)]")
91 choice = [getChoice(array)]
92 call disp%show("choice")
93 call disp%show( choice )
94 call disp%show("count = getUnifRand(1, size(array))")
95 count = getUnifRand(1, size(array))
96 call disp%show("count")
97 call disp%show( count )
98 call disp%show("choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.")
99 choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
100 call disp%show("choice")
101 call disp%show( choice )
102 call disp%show("choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
103 choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
104 call disp%show("choice")
105 call disp%show( choice )
106
107 end do
108 end block
109
110 block
111 logical, allocatable :: choice(:), array(:)
112 do itry = 1, ntry
113
114 call disp%skip
115 call disp%show("array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.")
116 array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
117 call disp%show("array")
118 call disp%show( array )
119 call disp%show("choice = [getChoice(array)]")
120 choice = [getChoice(array)]
121 call disp%show("choice")
122 call disp%show( choice )
123 call disp%show("count = getUnifRand(1, size(array))")
124 count = getUnifRand(1, size(array))
125 call disp%show("count")
126 call disp%show( count )
127 call disp%show("choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.")
128 choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
129 call disp%show("choice")
130 call disp%show( choice )
131 call disp%show("choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
132 choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
133 call disp%show("choice")
134 call disp%show( choice )
135
136 end do
137 end block
138
139 block
140 complex, allocatable :: choice(:), array(:)
141 do itry = 1, ntry
142
143 call disp%skip
144 call disp%show("array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.")
145 array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
146 call disp%show("array")
147 call disp%show( array )
148 call disp%show("choice = [getChoice(array)]")
149 choice = [getChoice(array)]
150 call disp%show("choice")
151 call disp%show( choice )
152 call disp%show("count = getUnifRand(1, size(array))")
153 count = getUnifRand(1, size(array))
154 call disp%show("count")
155 call disp%show( count )
156 call disp%show("choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.")
157 choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
158 call disp%show("choice")
159 call disp%show( choice )
160 call disp%show("choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
161 choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
162 call disp%show("choice")
163 call disp%show( choice )
164
165 end do
166 end block
167
168 block
169 real, allocatable :: choice(:), array(:)
170 do itry = 1, ntry
171
172 call disp%skip
173 call disp%show("array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.")
174 array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
175 call disp%show("array")
176 call disp%show( array )
177 call disp%show("choice = [getChoice(array)]")
178 choice = [getChoice(array)]
179 call disp%show("choice")
180 call disp%show( choice )
181 call disp%show("count = getUnifRand(1, size(array))")
182 count = getUnifRand(1, size(array))
183 call disp%show("count")
184 call disp%show( count )
185 call disp%show("choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.")
186 choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
187 call disp%show("choice")
188 call disp%show( choice )
189 call disp%show("choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.")
190 choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
191 call disp%show("choice")
192 call disp%show( choice )
193
194 end do
195 end block
196
197end program example
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
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 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"VHDIJZK"
6choice = getChoice(array)
7choice
8"J"
9count = getUnifRand(1, len(array))
10count
11+1
12choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
13choice
14"V"
15choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
16choice
17"V"
18
19count = getUnifRand(4, 10)
20array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
21array
22"OOYIPHRFFA"
23choice = getChoice(array)
24choice
25"R"
26count = getUnifRand(1, len(array))
27count
28+6
29choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
30choice
31"POYIFA"
32choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
33choice
34"FRFYPH"
35
36count = getUnifRand(4, 10)
37array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
38array
39"YOHDRHT"
40choice = getChoice(array)
41choice
42"H"
43count = getUnifRand(1, len(array))
44count
45+5
46choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
47choice
48"YYYHH"
49choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
50choice
51"TRHDY"
52
53count = getUnifRand(4, 10)
54array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
55array
56"UNBTBW"
57choice = getChoice(array)
58choice
59"B"
60count = getUnifRand(1, len(array))
61count
62+4
63choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
64choice
65"BWUU"
66choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
67choice
68"TBUB"
69
70count = getUnifRand(4, 10)
71array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
72array
73"UUBAUOTMNW"
74choice = getChoice(array)
75choice
76"A"
77count = getUnifRand(1, len(array))
78count
79+4
80choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
81choice
82"NUUB"
83choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
84choice
85"WNBU"
86
87count = getUnifRand(4, 10)
88array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
89array
90"IUXWSYMLLW"
91choice = getChoice(array)
92choice
93"U"
94count = getUnifRand(1, len(array))
95count
96+9
97choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
98choice
99"ULXYMUUXL"
100choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
101choice
102"WWMLXYIUS"
103
104count = getUnifRand(4, 10)
105array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
106array
107"BDYS"
108choice = getChoice(array)
109choice
110"Y"
111count = getUnifRand(1, len(array))
112count
113+1
114choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
115choice
116"B"
117choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
118choice
119"S"
120
121count = getUnifRand(4, 10)
122array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
123array
124"LKGLBTWC"
125choice = getChoice(array)
126choice
127"L"
128count = getUnifRand(1, len(array))
129count
130+1
131choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
132choice
133"L"
134choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
135choice
136"C"
137
138count = getUnifRand(4, 10)
139array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
140array
141"JIQQOQYK"
142choice = getChoice(array)
143choice
144"Q"
145count = getUnifRand(1, len(array))
146count
147+7
148choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
149choice
150"JQQIKQQ"
151choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
152choice
153"QOQYJIQ"
154
155count = getUnifRand(4, 10)
156array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
157array
158"SLEC"
159choice = getChoice(array)
160choice
161"C"
162count = getUnifRand(1, len(array))
163count
164+2
165choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
166choice
167"CE"
168choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
169choice
170"EC"
171
172count = getUnifRand(4, 10)
173array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
174array
175"RH", "ZA", "DF", "NV"
176choice = [getChoice(array)]
177choice
178"ZA"
179count = getUnifRand(1, len(array))
180count
181+2
182choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
183choice
184"RH", "DF"
185choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
186choice
187"RH", "ZA"
188
189count = getUnifRand(4, 10)
190array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
191array
192"FD", "CW", "AL", "KD"
193choice = [getChoice(array)]
194choice
195"AL"
196count = getUnifRand(1, len(array))
197count
198+2
199choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
200choice
201"AL", "FD"
202choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
203choice
204"AL", "KD"
205
206count = getUnifRand(4, 10)
207array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
208array
209"RP", "YW", "EY", "NH", "HP", "VT", "KR", "KJ", "CQ"
210choice = [getChoice(array)]
211choice
212"NH"
213count = getUnifRand(1, len(array))
214count
215+1
216choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
217choice
218"NH"
219choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
220choice
221"NH"
222
223count = getUnifRand(4, 10)
224array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
225array
226"OU", "DX", "YI", "EM", "DX", "KA"
227choice = [getChoice(array)]
228choice
229"OU"
230count = getUnifRand(1, len(array))
231count
232+1
233choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
234choice
235"KA"
236choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
237choice
238"KA"
239
240count = getUnifRand(4, 10)
241array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
242array
243"KZ", "SQ", "ZB", "PF", "WM", "BZ", "GN", "JU", "YY", "XK"
244choice = [getChoice(array)]
245choice
246"WM"
247count = getUnifRand(1, len(array))
248count
249+2
250choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
251choice
252"JU", "XK"
253choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
254choice
255"SQ", "JU"
256
257count = getUnifRand(4, 10)
258array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
259array
260"FI", "AI", "ZC", "DJ"
261choice = [getChoice(array)]
262choice
263"FI"
264count = getUnifRand(1, len(array))
265count
266+2
267choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
268choice
269"ZC", "FI"
270choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
271choice
272"FI", "ZC"
273
274count = getUnifRand(4, 10)
275array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
276array
277"GO", "US", "EE", "WR", "AI", "TT", "CP"
278choice = [getChoice(array)]
279choice
280"GO"
281count = getUnifRand(1, len(array))
282count
283+2
284choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
285choice
286"CP", "WR"
287choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
288choice
289"TT", "EE"
290
291count = getUnifRand(4, 10)
292array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
293array
294"PY", "HM", "GK", "QH", "ZR", "MZ"
295choice = [getChoice(array)]
296choice
297"MZ"
298count = getUnifRand(1, len(array))
299count
300+2
301choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
302choice
303"PY", "ZR"
304choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
305choice
306"ZR", "QH"
307
308count = getUnifRand(4, 10)
309array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
310array
311"RP", "UX", "SH", "AT", "CJ"
312choice = [getChoice(array)]
313choice
314"UX"
315count = getUnifRand(1, len(array))
316count
317+2
318choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
319choice
320"SH", "RP"
321choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
322choice
323"CJ", "SH"
324
325count = getUnifRand(4, 10)
326array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
327array
328"OH", "WX", "JO", "GR", "JI", "PP", "XX"
329choice = [getChoice(array)]
330choice
331"PP"
332count = getUnifRand(1, len(array))
333count
334+2
335choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
336choice
337"JO", "PP"
338choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
339choice
340"JI", "GR"
341
342array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
343array
344+4, +16, +2, +15
345choice = [getChoice(array)]
346choice
347+2
348count = getUnifRand(1, size(array))
349count
350+3
351choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
352choice
353+4, +15, +2
354choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
355choice
356+16, +4, +2
357
358array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
359array
360+4, +5, +5, +18, +12, +16, +2
361choice = [getChoice(array)]
362choice
363+18
364count = getUnifRand(1, size(array))
365count
366+4
367choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
368choice
369+2, +12, +18, +18
370choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
371choice
372+4, +5, +16, +18
373
374array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
375array
376+3, +11, +5, +20, +16, +4, +20, +14, +6
377choice = [getChoice(array)]
378choice
379+3
380count = getUnifRand(1, size(array))
381count
382+8
383choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
384choice
385+11, +14, +14, +11, +5, +3, +6, +14
386choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
387choice
388+20, +4, +11, +16, +5, +20, +14, +3
389
390array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
391array
392+18, +13, +12, +4, +6, +6, +8, +20, +5
393choice = [getChoice(array)]
394choice
395+20
396count = getUnifRand(1, size(array))
397count
398+3
399choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
400choice
401+8, +6, +5
402choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
403choice
404+18, +13, +6
405
406array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
407array
408+14, +20, +1, +8, +18, +17, +11, +6
409choice = [getChoice(array)]
410choice
411+17
412count = getUnifRand(1, size(array))
413count
414+8
415choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
416choice
417+20, +18, +20, +18, +1, +17, +20, +20
418choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
419choice
420+8, +11, +6, +17, +14, +1, +20, +18
421
422array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
423array
424+8, +19, +15, +16, +2, +14, +14
425choice = [getChoice(array)]
426choice
427+19
428count = getUnifRand(1, size(array))
429count
430+7
431choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
432choice
433+14, +15, +8, +2, +16, +16, +14
434choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
435choice
436+15, +2, +19, +14, +14, +16, +8
437
438array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
439array
440+18, +5, +19, +14, +13, +11
441choice = [getChoice(array)]
442choice
443+18
444count = getUnifRand(1, size(array))
445count
446+4
447choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
448choice
449+13, +5, +13, +5
450choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
451choice
452+11, +5, +14, +18
453
454array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
455array
456+20, +14, +9, +6
457choice = [getChoice(array)]
458choice
459+20
460count = getUnifRand(1, size(array))
461count
462+3
463choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
464choice
465+9, +14, +14
466choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
467choice
468+9, +14, +20
469
470array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
471array
472+19, +7, +17, +7
473choice = [getChoice(array)]
474choice
475+17
476count = getUnifRand(1, size(array))
477count
478+2
479choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
480choice
481+17, +7
482choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
483choice
484+19, +7
485
486array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
487array
488+18, +13, +17, +9, +14, +14, +17, +1
489choice = [getChoice(array)]
490choice
491+17
492count = getUnifRand(1, size(array))
493count
494+3
495choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
496choice
497+9, +17, +13
498choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
499choice
500+17, +1, +14
501
502array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
503array
504F, F, F, F, F, F, T, F, F
505choice = [getChoice(array)]
506choice
507F
508count = getUnifRand(1, size(array))
509count
510+2
511choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
512choice
513T, F
514choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
515choice
516F, F
517
518array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
519array
520T, F, T, T
521choice = [getChoice(array)]
522choice
523T
524count = getUnifRand(1, size(array))
525count
526+1
527choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
528choice
529F
530choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
531choice
532T
533
534array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
535array
536F, F, T, T, F, T
537choice = [getChoice(array)]
538choice
539T
540count = getUnifRand(1, size(array))
541count
542+5
543choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
544choice
545T, T, F, F, T
546choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
547choice
548T, T, F, T, F
549
550array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
551array
552F, F, T, F, F, T, F
553choice = [getChoice(array)]
554choice
555F
556count = getUnifRand(1, size(array))
557count
558+6
559choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
560choice
561F, F, T, F, F, F
562choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
563choice
564F, F, T, T, F, F
565
566array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
567array
568F, T, T, T, F, F, F
569choice = [getChoice(array)]
570choice
571F
572count = getUnifRand(1, size(array))
573count
574+7
575choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
576choice
577F, F, T, F, T, F, T
578choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
579choice
580F, F, F, F, T, T, T
581
582array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
583array
584T, F, F, F, F, T, T, T, F
585choice = [getChoice(array)]
586choice
587F
588count = getUnifRand(1, size(array))
589count
590+7
591choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
592choice
593F, T, F, T, T, T, F
594choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
595choice
596F, F, T, T, T, F, T
597
598array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
599array
600F, F, T, T, F, F, T, F
601choice = [getChoice(array)]
602choice
603F
604count = getUnifRand(1, size(array))
605count
606+1
607choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
608choice
609T
610choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
611choice
612F
613
614array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
615array
616T, T, T, F, T, T, T
617choice = [getChoice(array)]
618choice
619T
620count = getUnifRand(1, size(array))
621count
622+1
623choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
624choice
625T
626choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
627choice
628T
629
630array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
631array
632F, T, T, T, F
633choice = [getChoice(array)]
634choice
635T
636count = getUnifRand(1, size(array))
637count
638+3
639choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
640choice
641F, T, T
642choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
643choice
644T, F, T
645
646array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
647array
648F, F, T, F, F, F, T, F, T
649choice = [getChoice(array)]
650choice
651F
652count = getUnifRand(1, size(array))
653count
654+1
655choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
656choice
657T
658choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
659choice
660F
661
662array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
663array
664(+0.374058187, +0.885844290), (+0.814485490, +0.527484298), (+0.141393721, +0.691092193), (+0.189022243, +0.869544983)
665choice = [getChoice(array)]
666choice
667(+0.189022243, +0.869544983)
668count = getUnifRand(1, size(array))
669count
670+1
671choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
672choice
673(+0.814485490, +0.527484298)
674choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
675choice
676(+0.374058187, +0.885844290)
677
678array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
679array
680(+0.740833998, +0.512922227), (+0.993209839, +0.889324725), (+0.580825150, +0.791490197), (+0.657337010, +0.822503567), (+0.377134383, +0.195615947), (+0.574374259, +0.243366718), (+0.986312687, +0.312448144E-1), (+0.377138674, +0.792818904), (+0.225421607, +0.698013544)
681choice = [getChoice(array)]
682choice
683(+0.986312687, +0.312448144E-1)
684count = getUnifRand(1, size(array))
685count
686+1
687choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
688choice
689(+0.574374259, +0.243366718)
690choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
691choice
692(+0.993209839, +0.889324725)
693
694array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
695array
696(+0.749982774, +0.290094912), (+0.320613801, +0.167931437), (+0.767354965E-1, +0.518544376), (+0.747789562, +0.690199852), (+0.365580320E-1, +0.280780554), (+0.267590582, +0.185079396), (+0.290184259, +0.420109451)
697choice = [getChoice(array)]
698choice
699(+0.290184259, +0.420109451)
700count = getUnifRand(1, size(array))
701count
702+4
703choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
704choice
705(+0.267590582, +0.185079396), (+0.365580320E-1, +0.280780554), (+0.365580320E-1, +0.280780554), (+0.267590582, +0.185079396)
706choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
707choice
708(+0.267590582, +0.185079396), (+0.320613801, +0.167931437), (+0.747789562, +0.690199852), (+0.767354965E-1, +0.518544376)
709
710array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
711array
712(+0.153354466, +0.782560170), (+0.179885149, +0.287184238), (+0.517073810, +0.480103850), (+0.376599550, +0.268435717), (+0.813954473, +0.489808738), (+0.134206593, +0.983388007), (+0.752331555, +0.350939393)
713choice = [getChoice(array)]
714choice
715(+0.517073810, +0.480103850)
716count = getUnifRand(1, size(array))
717count
718+6
719choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
720choice
721(+0.134206593, +0.983388007), (+0.179885149, +0.287184238), (+0.153354466, +0.782560170), (+0.813954473, +0.489808738), (+0.813954473, +0.489808738), (+0.517073810, +0.480103850)
722choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
723choice
724(+0.813954473, +0.489808738), (+0.134206593, +0.983388007), (+0.179885149, +0.287184238), (+0.517073810, +0.480103850), (+0.376599550, +0.268435717), (+0.153354466, +0.782560170)
725
726array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
727array
728(+0.219640076, +0.984458566), (+0.854711175, +0.206710041), (+0.769144773, +0.496319950), (+0.297916710, +0.905627549), (+0.681777596E-1, +0.998073220E-1), (+0.486514270, +0.461860299E-1), (+0.587306261, +0.885457397E-1), (+0.274841845, +0.308029294)
729choice = [getChoice(array)]
730choice
731(+0.274841845, +0.308029294)
732count = getUnifRand(1, size(array))
733count
734+7
735choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
736choice
737(+0.681777596E-1, +0.998073220E-1), (+0.297916710, +0.905627549), (+0.854711175, +0.206710041), (+0.486514270, +0.461860299E-1), (+0.297916710, +0.905627549), (+0.219640076, +0.984458566), (+0.219640076, +0.984458566)
738choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
739choice
740(+0.769144773, +0.496319950), (+0.854711175, +0.206710041), (+0.486514270, +0.461860299E-1), (+0.587306261, +0.885457397E-1), (+0.681777596E-1, +0.998073220E-1), (+0.219640076, +0.984458566), (+0.274841845, +0.308029294)
741
742array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
743array
744(+0.780369520, +0.665161788), (+0.467737496, +0.575511754), (+0.579532981, +0.237561762), (+0.304479957, +0.450650632), (+0.430912077, +0.486155570), (+0.556580067, +0.160892963), (+0.598245382, +0.570949137)
745choice = [getChoice(array)]
746choice
747(+0.780369520, +0.665161788)
748count = getUnifRand(1, size(array))
749count
750+7
751choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
752choice
753(+0.430912077, +0.486155570), (+0.598245382, +0.570949137), (+0.780369520, +0.665161788), (+0.467737496, +0.575511754), (+0.598245382, +0.570949137), (+0.467737496, +0.575511754), (+0.579532981, +0.237561762)
754choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
755choice
756(+0.579532981, +0.237561762), (+0.780369520, +0.665161788), (+0.430912077, +0.486155570), (+0.304479957, +0.450650632), (+0.556580067, +0.160892963), (+0.598245382, +0.570949137), (+0.467737496, +0.575511754)
757
758array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
759array
760(+0.382196307E-1, +0.646403193), (+0.573816180, +0.382443428), (+0.476363957, +0.862502456), (+0.468582988, +0.915745318)
761choice = [getChoice(array)]
762choice
763(+0.476363957, +0.862502456)
764count = getUnifRand(1, size(array))
765count
766+1
767choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
768choice
769(+0.476363957, +0.862502456)
770choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
771choice
772(+0.382196307E-1, +0.646403193)
773
774array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
775array
776(+0.157265902, +0.306473672), (+0.129909217, +0.819146454), (+0.560992420, +0.624239743), (+0.335772038E-1, +0.709371448), (+0.844024599, +0.130358934), (+0.144730389, +0.277943552)
777choice = [getChoice(array)]
778choice
779(+0.844024599, +0.130358934)
780count = getUnifRand(1, size(array))
781count
782+5
783choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
784choice
785(+0.129909217, +0.819146454), (+0.335772038E-1, +0.709371448), (+0.335772038E-1, +0.709371448), (+0.157265902, +0.306473672), (+0.844024599, +0.130358934)
786choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
787choice
788(+0.844024599, +0.130358934), (+0.144730389, +0.277943552), (+0.157265902, +0.306473672), (+0.129909217, +0.819146454), (+0.560992420, +0.624239743)
789
790array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
791array
792(+0.860566258, +0.254181206), (+0.806035638, +0.653749287), (+0.547289848E-3, +0.895832658), (+0.174979866, +0.710737228), (+0.324550867, +0.729400098), (+0.874350131, +0.763191044), (+0.470665693E-1, +0.322290421), (+0.598706663, +0.351692140), (+0.154040694, +0.221372843E-1), (+0.400613785, +0.180302799)
793choice = [getChoice(array)]
794choice
795(+0.547289848E-3, +0.895832658)
796count = getUnifRand(1, size(array))
797count
798+5
799choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
800choice
801(+0.874350131, +0.763191044), (+0.400613785, +0.180302799), (+0.860566258, +0.254181206), (+0.874350131, +0.763191044), (+0.470665693E-1, +0.322290421)
802choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
803choice
804(+0.400613785, +0.180302799), (+0.598706663, +0.351692140), (+0.547289848E-3, +0.895832658), (+0.324550867, +0.729400098), (+0.174979866, +0.710737228)
805
806array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
807array
808(+0.940184951, +0.288660824), (+0.389396012, +0.768253326), (+0.831772089E-1, +0.584583640), (+0.892511964, +0.397785962), (+0.842156053, +0.274164438)
809choice = [getChoice(array)]
810choice
811(+0.940184951, +0.288660824)
812count = getUnifRand(1, size(array))
813count
814+4
815choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
816choice
817(+0.831772089E-1, +0.584583640), (+0.842156053, +0.274164438), (+0.831772089E-1, +0.584583640), (+0.842156053, +0.274164438)
818choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
819choice
820(+0.389396012, +0.768253326), (+0.842156053, +0.274164438), (+0.892511964, +0.397785962), (+0.831772089E-1, +0.584583640)
821
822array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
823array
824+0.202305079, +0.746083915, +0.998517990, +0.347499311
825choice = [getChoice(array)]
826choice
827+0.202305079
828count = getUnifRand(1, size(array))
829count
830+1
831choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
832choice
833+0.347499311
834choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
835choice
836+0.998517990
837
838array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
839array
840+0.566712022E-1, +0.124775052, +0.718719244, +0.386690915, +0.290210545, +0.142512619, +0.763249397E-2
841choice = [getChoice(array)]
842choice
843+0.290210545
844count = getUnifRand(1, size(array))
845count
846+3
847choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
848choice
849+0.718719244, +0.763249397E-2, +0.566712022E-1
850choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
851choice
852+0.386690915, +0.142512619, +0.763249397E-2
853
854array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
855array
856+0.384990394, +0.580645442, +0.205262303, +0.674935281
857choice = [getChoice(array)]
858choice
859+0.580645442
860count = getUnifRand(1, size(array))
861count
862+3
863choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
864choice
865+0.205262303, +0.580645442, +0.205262303
866choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
867choice
868+0.580645442, +0.674935281, +0.384990394
869
870array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
871array
872+0.261852562, +0.968958497, +0.151841581, +0.618396819, +0.690966845E-2, +0.945225835
873choice = [getChoice(array)]
874choice
875+0.690966845E-2
876count = getUnifRand(1, size(array))
877count
878+1
879choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
880choice
881+0.261852562
882choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
883choice
884+0.618396819
885
886array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
887array
888+0.825588107, +0.132828295, +0.528904259, +0.123508573E-1, +0.935625136, +0.790401340, +0.721885800, +0.586476803
889choice = [getChoice(array)]
890choice
891+0.935625136
892count = getUnifRand(1, size(array))
893count
894+6
895choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
896choice
897+0.721885800, +0.586476803, +0.790401340, +0.721885800, +0.825588107, +0.721885800
898choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
899choice
900+0.825588107, +0.586476803, +0.123508573E-1, +0.132828295, +0.935625136, +0.790401340
901
902array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
903array
904+0.584203660, +0.665777922E-1, +0.716739953, +0.435676455, +0.153090060, +0.651799262, +0.150417447
905choice = [getChoice(array)]
906choice
907+0.150417447
908count = getUnifRand(1, size(array))
909count
910+3
911choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
912choice
913+0.435676455, +0.716739953, +0.716739953
914choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
915choice
916+0.153090060, +0.665777922E-1, +0.716739953
917
918array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
919array
920+0.558369160E-1, +0.660697043, +0.608680606, +0.769476473, +0.279466391, +0.578054190, +0.694419444, +0.908959746, +0.384919941, +0.297638834
921choice = [getChoice(array)]
922choice
923+0.908959746
924count = getUnifRand(1, size(array))
925count
926+1
927choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
928choice
929+0.660697043
930choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
931choice
932+0.908959746
933
934array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
935array
936+0.196701229, +0.470034361, +0.984851182, +0.343784690, +0.109392703, +0.776947677, +0.970441043, +0.841418386
937choice = [getChoice(array)]
938choice
939+0.970441043
940count = getUnifRand(1, size(array))
941count
942+2
943choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
944choice
945+0.841418386, +0.109392703
946choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
947choice
948+0.841418386, +0.196701229
949
950array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
951array
952+0.158900559, +0.187494099, +0.970411181, +0.268743873, +0.387034774, +0.885374844, +0.592745960
953choice = [getChoice(array)]
954choice
955+0.970411181
956count = getUnifRand(1, size(array))
957count
958+6
959choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
960choice
961+0.187494099, +0.387034774, +0.970411181, +0.158900559, +0.387034774, +0.592745960
962choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
963choice
964+0.268743873, +0.970411181, +0.592745960, +0.187494099, +0.885374844, +0.387034774
965
966array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
967array
968+0.415293813, +0.677642643, +0.341537535, +0.665220141, +0.851708829, +0.853776336, +0.155038118, +0.345826805
969choice = [getChoice(array)]
970choice
971+0.853776336
972count = getUnifRand(1, size(array))
973count
974+7
975choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
976choice
977+0.677642643, +0.677642643, +0.341537535, +0.415293813, +0.155038118, +0.345826805, +0.677642643
978choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
979choice
980+0.851708829, +0.853776336, +0.345826805, +0.665220141, +0.155038118, +0.341537535, +0.415293813
981
Test:
test_pm_arrayChoice


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 137 of file pm_arrayChoice.F90.


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