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"ZFKD"
6choice = getChoice(array)
7choice
8"K"
9count = getUnifRand(1, len(array))
10count
11+4
12choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
13choice
14"ZFZZ"
15choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
16choice
17"DFZK"
18
19count = getUnifRand(4, 10)
20array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
21array
22"PUYDP"
23choice = getChoice(array)
24choice
25"P"
26count = getUnifRand(1, len(array))
27count
28+3
29choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
30choice
31"DPP"
32choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
33choice
34"PPD"
35
36count = getUnifRand(4, 10)
37array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
38array
39"DVFKSHBR"
40choice = getChoice(array)
41choice
42"S"
43count = getUnifRand(1, len(array))
44count
45+5
46choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
47choice
48"FBHDK"
49choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
50choice
51"FBVHK"
52
53count = getUnifRand(4, 10)
54array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
55array
56"MRBTQLIYL"
57choice = getChoice(array)
58choice
59"L"
60count = getUnifRand(1, len(array))
61count
62+8
63choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
64choice
65"ILTQITYT"
66choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
67choice
68"MLYIRBQT"
69
70count = getUnifRand(4, 10)
71array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
72array
73"GYEVMAY"
74choice = getChoice(array)
75choice
76"M"
77count = getUnifRand(1, len(array))
78count
79+1
80choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
81choice
82"A"
83choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
84choice
85"M"
86
87count = getUnifRand(4, 10)
88array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
89array
90"MBSE"
91choice = getChoice(array)
92choice
93"B"
94count = getUnifRand(1, len(array))
95count
96+2
97choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
98choice
99"EM"
100choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
101choice
102"MS"
103
104count = getUnifRand(4, 10)
105array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
106array
107"PKELP"
108choice = getChoice(array)
109choice
110"P"
111count = getUnifRand(1, len(array))
112count
113+1
114choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
115choice
116"P"
117choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
118choice
119"K"
120
121count = getUnifRand(4, 10)
122array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
123array
124"TZASOM"
125choice = getChoice(array)
126choice
127"T"
128count = getUnifRand(1, len(array))
129count
130+6
131choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
132choice
133"ATASZA"
134choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
135choice
136"SMAOTZ"
137
138count = getUnifRand(4, 10)
139array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
140array
141"GKIQ"
142choice = getChoice(array)
143choice
144"K"
145count = getUnifRand(1, len(array))
146count
147+1
148choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
149choice
150"Q"
151choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
152choice
153"Q"
154
155count = getUnifRand(4, 10)
156array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
157array
158"MJZMKWEIE"
159choice = getChoice(array)
160choice
161"W"
162count = getUnifRand(1, len(array))
163count
164+7
165choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
166choice
167"MEEKWKK"
168choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
169choice
170"WMMEKZJ"
171
172count = getUnifRand(4, 10)
173array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
174array
175"ID", "QE", "KR", "NX", "FV"
176choice = [getChoice(array)]
177choice
178"ID"
179count = getUnifRand(1, len(array))
180count
181+2
182choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
183choice
184"NX", "QE"
185choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
186choice
187"ID", "KR"
188
189count = getUnifRand(4, 10)
190array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
191array
192"LT", "RB", "FV", "RR", "WY", "OJ"
193choice = [getChoice(array)]
194choice
195"LT"
196count = getUnifRand(1, len(array))
197count
198+2
199choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
200choice
201"OJ", "LT"
202choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
203choice
204"LT", "OJ"
205
206count = getUnifRand(4, 10)
207array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
208array
209"CR", "UH", "YP", "SP", "EQ", "XU", "LN", "TI"
210choice = [getChoice(array)]
211choice
212"EQ"
213count = getUnifRand(1, len(array))
214count
215+1
216choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
217choice
218"EQ"
219choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
220choice
221"TI"
222
223count = getUnifRand(4, 10)
224array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
225array
226"DA", "BE", "QS", "QD", "HP", "QN", "LP", "MR"
227choice = [getChoice(array)]
228choice
229"LP"
230count = getUnifRand(1, len(array))
231count
232+1
233choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
234choice
235"LP"
236choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
237choice
238"HP"
239
240count = getUnifRand(4, 10)
241array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
242array
243"HX", "XI", "LK", "DW", "VU", "RK"
244choice = [getChoice(array)]
245choice
246"RK"
247count = getUnifRand(1, len(array))
248count
249+2
250choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
251choice
252"LK", "LK"
253choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
254choice
255"XI", "RK"
256
257count = getUnifRand(4, 10)
258array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
259array
260"MF", "UW", "IY", "AG", "BL"
261choice = [getChoice(array)]
262choice
263"UW"
264count = getUnifRand(1, len(array))
265count
266+1
267choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
268choice
269"BL"
270choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
271choice
272"MF"
273
274count = getUnifRand(4, 10)
275array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
276array
277"QC", "YB", "BO", "SW", "QX", "EO", "PA", "GZ"
278choice = [getChoice(array)]
279choice
280"GZ"
281count = getUnifRand(1, len(array))
282count
283+2
284choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
285choice
286"BO", "SW"
287choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
288choice
289"GZ", "YB"
290
291count = getUnifRand(4, 10)
292array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
293array
294"UN", "DP", "WI", "IY", "FB", "UP", "LV"
295choice = [getChoice(array)]
296choice
297"IY"
298count = getUnifRand(1, len(array))
299count
300+1
301choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
302choice
303"WI"
304choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
305choice
306"WI"
307
308count = getUnifRand(4, 10)
309array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
310array
311"QN", "BS", "DM", "AW", "OM", "SP", "CB"
312choice = [getChoice(array)]
313choice
314"AW"
315count = getUnifRand(1, len(array))
316count
317+1
318choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
319choice
320"DM"
321choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
322choice
323"QN"
324
325count = getUnifRand(4, 10)
326array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
327array
328"JL", "JO", "ZY", "GC"
329choice = [getChoice(array)]
330choice
331"ZY"
332count = getUnifRand(1, len(array))
333count
334+1
335choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
336choice
337"GC"
338choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
339choice
340"JO"
341
342array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
343array
344+19, +14, +20, +10, +7, +19, +14, +13, +16, +8
345choice = [getChoice(array)]
346choice
347+8
348count = getUnifRand(1, size(array))
349count
350+2
351choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
352choice
353+20, +13
354choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
355choice
356+10, +7
357
358array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
359array
360+16, +15, +3, +17, +17, +8, +13
361choice = [getChoice(array)]
362choice
363+8
364count = getUnifRand(1, size(array))
365count
366+2
367choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
368choice
369+17, +8
370choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
371choice
372+3, +8
373
374array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
375array
376+10, +1, +12, +17, +10, +2, +5, +4, +6
377choice = [getChoice(array)]
378choice
379+2
380count = getUnifRand(1, size(array))
381count
382+9
383choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
384choice
385+6, +1, +12, +5, +10, +10, +10, +2, +12
386choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
387choice
388+2, +10, +6, +12, +1, +10, +4, +5, +17
389
390array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
391array
392+7, +12, +7, +12, +7, +7, +14
393choice = [getChoice(array)]
394choice
395+7
396count = getUnifRand(1, size(array))
397count
398+6
399choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
400choice
401+7, +7, +14, +7, +7, +12
402choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
403choice
404+14, +12, +7, +7, +7, +7
405
406array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
407array
408+10, +16, +18, +13, +8, +20, +10, +6, +1, +6
409choice = [getChoice(array)]
410choice
411+10
412count = getUnifRand(1, size(array))
413count
414+2
415choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
416choice
417+1, +10
418choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
419choice
420+10, +16
421
422array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
423array
424+5, +7, +13, +11, +20, +14
425choice = [getChoice(array)]
426choice
427+13
428count = getUnifRand(1, size(array))
429count
430+5
431choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
432choice
433+7, +20, +13, +7, +13
434choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
435choice
436+14, +13, +20, +11, +7
437
438array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
439array
440+17, +15, +19, +13, +16, +4, +4, +6
441choice = [getChoice(array)]
442choice
443+4
444count = getUnifRand(1, size(array))
445count
446+1
447choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
448choice
449+15
450choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
451choice
452+13
453
454array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
455array
456+4, +10, +15, +19, +6, +15, +3, +3, +10
457choice = [getChoice(array)]
458choice
459+4
460count = getUnifRand(1, size(array))
461count
462+9
463choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
464choice
465+6, +3, +3, +3, +6, +3, +19, +10, +15
466choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
467choice
468+19, +10, +6, +10, +3, +4, +3, +15, +15
469
470array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
471array
472+20, +13, +18, +15, +19, +5, +14, +18, +12, +9
473choice = [getChoice(array)]
474choice
475+18
476count = getUnifRand(1, size(array))
477count
478+2
479choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
480choice
481+5, +18
482choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
483choice
484+14, +15
485
486array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
487array
488+10, +10, +20, +1, +18, +12
489choice = [getChoice(array)]
490choice
491+20
492count = getUnifRand(1, size(array))
493count
494+6
495choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
496choice
497+10, +18, +18, +12, +12, +20
498choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
499choice
500+20, +18, +1, +10, +10, +12
501
502array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
503array
504F, F, T, T, F, T, F
505choice = [getChoice(array)]
506choice
507F
508count = getUnifRand(1, size(array))
509count
510+7
511choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
512choice
513F, F, T, T, F, F, T
514choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
515choice
516T, T, F, F, F, T, F
517
518array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
519array
520T, F, F, F, T, T, T, T, F, T
521choice = [getChoice(array)]
522choice
523T
524count = getUnifRand(1, size(array))
525count
526+9
527choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
528choice
529T, F, F, T, T, T, F, T, T
530choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
531choice
532F, F, T, T, T, T, F, T, F
533
534array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
535array
536F, F, F, F, T, F, T, T, T
537choice = [getChoice(array)]
538choice
539T
540count = getUnifRand(1, size(array))
541count
542+9
543choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
544choice
545F, F, F, F, T, F, F, F, F
546choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
547choice
548F, T, F, F, T, F, F, T, T
549
550array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
551array
552T, F, T, T, T, T
553choice = [getChoice(array)]
554choice
555T
556count = getUnifRand(1, size(array))
557count
558+3
559choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
560choice
561T, T, F
562choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
563choice
564T, T, T
565
566array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
567array
568T, T, T, F, T, T, F
569choice = [getChoice(array)]
570choice
571F
572count = getUnifRand(1, size(array))
573count
574+2
575choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
576choice
577T, T
578choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
579choice
580T, F
581
582array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
583array
584F, T, F, F, F, F, F, T, F, T
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, F, F, F, F, F, F
594choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
595choice
596F, F, T, T, F, F, F
597
598array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
599array
600T, F, T, F
601choice = [getChoice(array)]
602choice
603T
604count = getUnifRand(1, size(array))
605count
606+2
607choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
608choice
609F, T
610choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
611choice
612F, T
613
614array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
615array
616T, T, T, T, T, F, T, F, F
617choice = [getChoice(array)]
618choice
619T
620count = getUnifRand(1, size(array))
621count
622+9
623choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
624choice
625T, T, T, F, T, T, T, T, F
626choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
627choice
628F, F, T, F, T, T, T, T, T
629
630array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
631array
632F, T, T, T, F, 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
641T, 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, F, T, T
649choice = [getChoice(array)]
650choice
651F
652count = getUnifRand(1, size(array))
653count
654+3
655choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
656choice
657T, F, F
658choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
659choice
660F, T, T
661
662array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
663array
664(+0.689017415, +0.153150856), (+0.945121527, +0.506114721), (+0.389236212E-2, +0.668094039), (+0.956667662, +0.694056094), (+0.966429114E-1, +0.644592285), (+0.357315719, +0.857949674), (+0.257722199, +0.616719723E-1)
665choice = [getChoice(array)]
666choice
667(+0.956667662, +0.694056094)
668count = getUnifRand(1, size(array))
669count
670+7
671choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
672choice
673(+0.689017415, +0.153150856), (+0.689017415, +0.153150856), (+0.945121527, +0.506114721), (+0.956667662, +0.694056094), (+0.945121527, +0.506114721), (+0.357315719, +0.857949674), (+0.689017415, +0.153150856)
674choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
675choice
676(+0.956667662, +0.694056094), (+0.357315719, +0.857949674), (+0.257722199, +0.616719723E-1), (+0.966429114E-1, +0.644592285), (+0.689017415, +0.153150856), (+0.945121527, +0.506114721), (+0.389236212E-2, +0.668094039)
677
678array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
679array
680(+0.369111478, +0.262841046), (+0.561512113, +0.677424252), (+0.392780483, +0.468913436), (+0.228224754, +0.229533732), (+0.239413738, +0.813751101), (+0.493590713, +0.253610611E-1), (+0.688393772, +0.858648181)
681choice = [getChoice(array)]
682choice
683(+0.561512113, +0.677424252)
684count = getUnifRand(1, size(array))
685count
686+5
687choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
688choice
689(+0.228224754, +0.229533732), (+0.493590713, +0.253610611E-1), (+0.369111478, +0.262841046), (+0.392780483, +0.468913436), (+0.561512113, +0.677424252)
690choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
691choice
692(+0.369111478, +0.262841046), (+0.493590713, +0.253610611E-1), (+0.228224754, +0.229533732), (+0.239413738, +0.813751101), (+0.561512113, +0.677424252)
693
694array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
695array
696(+0.759587705, +0.414832056), (+0.389454305, +0.311983287), (+0.847347200, +0.765620410), (+0.149498224, +0.854240775), (+0.373074770, +0.667240977), (+0.140563309, +0.877849817), (+0.288196385, +0.444101155)
697choice = [getChoice(array)]
698choice
699(+0.140563309, +0.877849817)
700count = getUnifRand(1, size(array))
701count
702+4
703choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
704choice
705(+0.140563309, +0.877849817), (+0.847347200, +0.765620410), (+0.847347200, +0.765620410), (+0.389454305, +0.311983287)
706choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
707choice
708(+0.389454305, +0.311983287), (+0.847347200, +0.765620410), (+0.759587705, +0.414832056), (+0.288196385, +0.444101155)
709
710array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
711array
712(+0.547553957, +0.478401959), (+0.181211531, +0.923447490), (+0.903124511, +0.419654310), (+0.592447579, +0.453875124), (+0.369096279, +0.935822725E-1), (+0.224496007, +0.155475318), (+0.329653621E-1, +0.993686557), (+0.162004292, +0.338477075), (+0.361967683E-1, +0.949537992)
713choice = [getChoice(array)]
714choice
715(+0.224496007, +0.155475318)
716count = getUnifRand(1, size(array))
717count
718+4
719choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
720choice
721(+0.903124511, +0.419654310), (+0.369096279, +0.935822725E-1), (+0.181211531, +0.923447490), (+0.224496007, +0.155475318)
722choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
723choice
724(+0.369096279, +0.935822725E-1), (+0.361967683E-1, +0.949537992), (+0.547553957, +0.478401959), (+0.903124511, +0.419654310)
725
726array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
727array
728(+0.470657706, +0.199811220), (+0.801813424, +0.269964695), (+0.464511216, +0.124970734), (+0.993036866, +0.475584328), (+0.117533624, +0.230517030), (+0.522841692, +0.222008228), (+0.943279445, +0.944633842), (+0.216920376, +0.259681463), (+0.314968288, +0.672404230), (+0.184636772, +0.125122786)
729choice = [getChoice(array)]
730choice
731(+0.314968288, +0.672404230)
732count = getUnifRand(1, size(array))
733count
734+7
735choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
736choice
737(+0.943279445, +0.944633842), (+0.993036866, +0.475584328), (+0.801813424, +0.269964695), (+0.184636772, +0.125122786), (+0.314968288, +0.672404230), (+0.464511216, +0.124970734), (+0.216920376, +0.259681463)
738choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
739choice
740(+0.464511216, +0.124970734), (+0.522841692, +0.222008228), (+0.314968288, +0.672404230), (+0.943279445, +0.944633842), (+0.216920376, +0.259681463), (+0.801813424, +0.269964695), (+0.117533624, +0.230517030)
741
742array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
743array
744(+0.293794990, +0.266498685), (+0.781942427, +0.306661248), (+0.577713549, +0.448529661), (+0.701519251, +0.709551632), (+0.335577965, +0.585473180), (+0.544744015, +0.429433703), (+0.727976680, +0.778172374), (+0.625442624, +0.188105762)
745choice = [getChoice(array)]
746choice
747(+0.544744015, +0.429433703)
748count = getUnifRand(1, size(array))
749count
750+5
751choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
752choice
753(+0.335577965, +0.585473180), (+0.577713549, +0.448529661), (+0.293794990, +0.266498685), (+0.727976680, +0.778172374), (+0.293794990, +0.266498685)
754choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
755choice
756(+0.577713549, +0.448529661), (+0.335577965, +0.585473180), (+0.727976680, +0.778172374), (+0.701519251, +0.709551632), (+0.544744015, +0.429433703)
757
758array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
759array
760(+0.270026922E-1, +0.664817393), (+0.889678299, +0.341229439), (+0.299868822, +0.357580900), (+0.919970930, +0.453164995), (+0.204000175, +0.318107188), (+0.889628410, +0.782292247)
761choice = [getChoice(array)]
762choice
763(+0.889628410, +0.782292247)
764count = getUnifRand(1, size(array))
765count
766+6
767choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
768choice
769(+0.299868822, +0.357580900), (+0.919970930, +0.453164995), (+0.889628410, +0.782292247), (+0.299868822, +0.357580900), (+0.270026922E-1, +0.664817393), (+0.889678299, +0.341229439)
770choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
771choice
772(+0.889678299, +0.341229439), (+0.270026922E-1, +0.664817393), (+0.204000175, +0.318107188), (+0.919970930, +0.453164995), (+0.889628410, +0.782292247), (+0.299868822, +0.357580900)
773
774array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
775array
776(+0.951709986, +0.947244883), (+0.782976449, +0.576056838), (+0.384249806, +0.855426908), (+0.725116670, +0.422025442), (+0.257666767, +0.806514740), (+0.370893300, +0.994922519E-1), (+0.157297850, +0.378020942), (+0.396809757, +0.594036222), (+0.372005641, +0.405997515)
777choice = [getChoice(array)]
778choice
779(+0.372005641, +0.405997515)
780count = getUnifRand(1, size(array))
781count
782+3
783choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
784choice
785(+0.725116670, +0.422025442), (+0.372005641, +0.405997515), (+0.396809757, +0.594036222)
786choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
787choice
788(+0.370893300, +0.994922519E-1), (+0.725116670, +0.422025442), (+0.384249806, +0.855426908)
789
790array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
791array
792(+0.278054953, +0.451172829), (+0.285857141, +0.621685863), (+0.466081560, +0.616114676), (+0.743892252, +0.478729606E-1), (+0.251291692, +0.478526890), (+0.901331902, +0.192070603E-1)
793choice = [getChoice(array)]
794choice
795(+0.251291692, +0.478526890)
796count = getUnifRand(1, size(array))
797count
798+3
799choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
800choice
801(+0.285857141, +0.621685863), (+0.743892252, +0.478729606E-1), (+0.285857141, +0.621685863)
802choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
803choice
804(+0.251291692, +0.478526890), (+0.278054953, +0.451172829), (+0.743892252, +0.478729606E-1)
805
806array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
807array
808(+0.541020036, +0.891036689), (+0.890317738, +0.728464901), (+0.440684140, +0.406738460), (+0.588295519, +0.427248538), (+0.408861518, +0.477115929), (+0.111218750, +0.381124914)
809choice = [getChoice(array)]
810choice
811(+0.541020036, +0.891036689)
812count = getUnifRand(1, size(array))
813count
814+2
815choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
816choice
817(+0.408861518, +0.477115929), (+0.408861518, +0.477115929)
818choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
819choice
820(+0.440684140, +0.406738460), (+0.541020036, +0.891036689)
821
822array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
823array
824+0.212115526, +0.431756854, +0.317880273, +0.451421022, +0.835779130, +0.675285459, +0.978559256E-2, +0.651251435, +0.673030376
825choice = [getChoice(array)]
826choice
827+0.675285459
828count = getUnifRand(1, size(array))
829count
830+8
831choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
832choice
833+0.675285459, +0.978559256E-2, +0.212115526, +0.431756854, +0.978559256E-2, +0.673030376, +0.673030376, +0.673030376
834choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
835choice
836+0.451421022, +0.431756854, +0.317880273, +0.835779130, +0.212115526, +0.673030376, +0.651251435, +0.675285459
837
838array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
839array
840+0.362502456, +0.927836001, +0.795209408, +0.871660709E-1, +0.186204255, +0.409542978, +0.249824047, +0.407528937, +0.784366310, +0.424451470
841choice = [getChoice(array)]
842choice
843+0.407528937
844count = getUnifRand(1, size(array))
845count
846+4
847choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
848choice
849+0.424451470, +0.407528937, +0.249824047, +0.424451470
850choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
851choice
852+0.186204255, +0.362502456, +0.871660709E-1, +0.795209408
853
854array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
855array
856+0.866697967, +0.530914247, +0.680905104, +0.769135952
857choice = [getChoice(array)]
858choice
859+0.680905104
860count = getUnifRand(1, size(array))
861count
862+2
863choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
864choice
865+0.530914247, +0.530914247
866choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
867choice
868+0.680905104, +0.769135952
869
870array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
871array
872+0.647201896, +0.643590152, +0.213528097, +0.923678517, +0.651192009, +0.639768720, +0.338557959, +0.639707029, +0.908155739, +0.271939158
873choice = [getChoice(array)]
874choice
875+0.908155739
876count = getUnifRand(1, size(array))
877count
878+9
879choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
880choice
881+0.651192009, +0.213528097, +0.213528097, +0.908155739, +0.639768720, +0.271939158, +0.647201896, +0.647201896, +0.271939158
882choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
883choice
884+0.271939158, +0.647201896, +0.651192009, +0.639768720, +0.213528097, +0.643590152, +0.338557959, +0.908155739, +0.639707029
885
886array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
887array
888+0.654499352, +0.993079364, +0.939329863, +0.753258228, +0.476211309E-1, +0.296486795, +0.925389886, +0.978245080
889choice = [getChoice(array)]
890choice
891+0.654499352
892count = getUnifRand(1, size(array))
893count
894+1
895choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
896choice
897+0.753258228
898choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
899choice
900+0.476211309E-1
901
902array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
903array
904+0.193377674, +0.361907482, +0.984295011, +0.725786686E-1, +0.306308866, +0.969908655
905choice = [getChoice(array)]
906choice
907+0.306308866
908count = getUnifRand(1, size(array))
909count
910+1
911choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
912choice
913+0.984295011
914choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
915choice
916+0.725786686E-1
917
918array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
919array
920+0.130937099, +0.118659198, +0.294595540, +0.465088665, +0.882933080, +0.374153793, +0.451860487, +0.377380371, +0.151105464
921choice = [getChoice(array)]
922choice
923+0.374153793
924count = getUnifRand(1, size(array))
925count
926+3
927choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
928choice
929+0.451860487, +0.451860487, +0.294595540
930choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
931choice
932+0.377380371, +0.151105464, +0.374153793
933
934array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
935array
936+0.851645291, +0.568964064, +0.344393790, +0.857476890, +0.702789605, +0.706541300, +0.483110607, +0.727096379
937choice = [getChoice(array)]
938choice
939+0.702789605
940count = getUnifRand(1, size(array))
941count
942+2
943choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
944choice
945+0.706541300, +0.702789605
946choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
947choice
948+0.344393790, +0.568964064
949
950array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
951array
952+0.441544890, +0.653909624, +0.393957973, +0.887597799E-1, +0.772615135, +0.146761537, +0.138246417E-1, +0.850942433
953choice = [getChoice(array)]
954choice
955+0.653909624
956count = getUnifRand(1, size(array))
957count
958+6
959choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
960choice
961+0.146761537, +0.772615135, +0.887597799E-1, +0.850942433, +0.393957973, +0.850942433
962choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
963choice
964+0.772615135, +0.138246417E-1, +0.441544890, +0.653909624, +0.393957973, +0.887597799E-1
965
966array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
967array
968+0.385955632, +0.647227585, +0.421333015, +0.236858070, +0.846276522, +0.941759765
969choice = [getChoice(array)]
970choice
971+0.236858070
972count = getUnifRand(1, size(array))
973count
974+3
975choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
976choice
977+0.647227585, +0.421333015, +0.236858070
978choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
979choice
980+0.421333015, +0.941759765, +0.385955632
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: