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"MPKSU"
6choice = getChoice(array)
7choice
8"S"
9count = getUnifRand(1, len(array))
10count
11+1
12choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
13choice
14"M"
15choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
16choice
17"K"
18
19count = getUnifRand(4, 10)
20array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
21array
22"VRDGZ"
23choice = getChoice(array)
24choice
25"Z"
26count = getUnifRand(1, len(array))
27count
28+3
29choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
30choice
31"DVR"
32choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
33choice
34"ZGD"
35
36count = getUnifRand(4, 10)
37array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
38array
39"LYDZRW"
40choice = getChoice(array)
41choice
42"W"
43count = getUnifRand(1, len(array))
44count
45+1
46choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
47choice
48"Y"
49choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
50choice
51"Z"
52
53count = getUnifRand(4, 10)
54array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
55array
56"VGUX"
57choice = getChoice(array)
58choice
59"U"
60count = getUnifRand(1, len(array))
61count
62+2
63choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
64choice
65"XX"
66choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
67choice
68"GU"
69
70count = getUnifRand(4, 10)
71array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
72array
73"OKYWMGX"
74choice = getChoice(array)
75choice
76"G"
77count = getUnifRand(1, len(array))
78count
79+3
80choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
81choice
82"KXX"
83choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
84choice
85"GOW"
86
87count = getUnifRand(4, 10)
88array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
89array
90"ZIZURKIM"
91choice = getChoice(array)
92choice
93"Z"
94count = getUnifRand(1, len(array))
95count
96+7
97choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
98choice
99"MIRRRIR"
100choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
101choice
102"IUKIZZM"
103
104count = getUnifRand(4, 10)
105array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
106array
107"PGSKPWQHV"
108choice = getChoice(array)
109choice
110"W"
111count = getUnifRand(1, len(array))
112count
113+7
114choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
115choice
116"QSQKHSK"
117choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
118choice
119"SQVPKWH"
120
121count = getUnifRand(4, 10)
122array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
123array
124"DQUV"
125choice = getChoice(array)
126choice
127"U"
128count = getUnifRand(1, len(array))
129count
130+1
131choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
132choice
133"Q"
134choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
135choice
136"V"
137
138count = getUnifRand(4, 10)
139array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
140array
141"XOCNPQTAU"
142choice = getChoice(array)
143choice
144"N"
145count = getUnifRand(1, len(array))
146count
147+7
148choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
149choice
150"PPTTTXN"
151choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
152choice
153"ATUOQPC"
154
155count = getUnifRand(4, 10)
156array = getUnifRand(repeat('A', count), repeat('Z', count)) ! generate random array for illustration.
157array
158"JMHLS"
159choice = getChoice(array)
160choice
161"S"
162count = getUnifRand(1, len(array))
163count
164+4
165choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
166choice
167"LJHM"
168choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
169choice
170"SHML"
171
172count = getUnifRand(4, 10)
173array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
174array
175"NM", "WH", "XZ", "MD", "HY", "BB", "UC", "KI"
176choice = [getChoice(array)]
177choice
178"NM"
179count = getUnifRand(1, len(array))
180count
181+2
182choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
183choice
184"BB", "KI"
185choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
186choice
187"UC", "HY"
188
189count = getUnifRand(4, 10)
190array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
191array
192"EP", "QL", "RB", "CI", "CP", "MG", "HX"
193choice = [getChoice(array)]
194choice
195"RB"
196count = getUnifRand(1, len(array))
197count
198+2
199choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
200choice
201"RB", "RB"
202choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
203choice
204"EP", "CI"
205
206count = getUnifRand(4, 10)
207array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
208array
209"DL", "CL", "ZI", "QK", "TZ", "ZV", "XC"
210choice = [getChoice(array)]
211choice
212"ZI"
213count = getUnifRand(1, len(array))
214count
215+1
216choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
217choice
218"ZI"
219choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
220choice
221"ZV"
222
223count = getUnifRand(4, 10)
224array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
225array
226"DC", "OI", "SB", "XE", "GB", "BN", "CO"
227choice = [getChoice(array)]
228choice
229"CO"
230count = getUnifRand(1, len(array))
231count
232+1
233choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
234choice
235"XE"
236choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
237choice
238"CO"
239
240count = getUnifRand(4, 10)
241array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
242array
243"CS", "LL", "MH", "ZQ", "PJ", "NA", "MA", "KV"
244choice = [getChoice(array)]
245choice
246"CS"
247count = getUnifRand(1, len(array))
248count
249+1
250choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
251choice
252"KV"
253choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
254choice
255"NA"
256
257count = getUnifRand(4, 10)
258array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
259array
260"CD", "DL", "XV", "IS", "VR", "TP", "WP", "XJ", "MV"
261choice = [getChoice(array)]
262choice
263"IS"
264count = getUnifRand(1, len(array))
265count
266+1
267choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
268choice
269"XJ"
270choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
271choice
272"XJ"
273
274count = getUnifRand(4, 10)
275array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
276array
277"KH", "JN", "JT", "LR", "HK", "KR", "EJ", "HM", "UW", "PE"
278choice = [getChoice(array)]
279choice
280"PE"
281count = getUnifRand(1, len(array))
282count
283+1
284choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
285choice
286"UW"
287choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
288choice
289"KR"
290
291count = getUnifRand(4, 10)
292array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
293array
294"JD", "DA", "AS", "AG", "LB", "PX", "ON", "OH"
295choice = [getChoice(array)]
296choice
297"OH"
298count = getUnifRand(1, len(array))
299count
300+1
301choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
302choice
303"AG"
304choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
305choice
306"JD"
307
308count = getUnifRand(4, 10)
309array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
310array
311"TA", "WN", "HC", "RQ", "DY", "TS", "TO", "RL"
312choice = [getChoice(array)]
313choice
314"DY"
315count = getUnifRand(1, len(array))
316count
317+1
318choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
319choice
320"WN"
321choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
322choice
323"TS"
324
325count = getUnifRand(4, 10)
326array = getUnifRand('AA', 'ZZ', count) ! generate random array for illustration.
327array
328"WB", "ZK", "XG", "MY", "ZS", "YF", "KZ", "XF", "KY"
329choice = [getChoice(array)]
330choice
331"WB"
332count = getUnifRand(1, len(array))
333count
334+2
335choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
336choice
337"KZ", "MY"
338choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
339choice
340"ZS", "ZK"
341
342array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
343array
344+2, +3, +4, +18, +3, +14, +4, +13
345choice = [getChoice(array)]
346choice
347+13
348count = getUnifRand(1, size(array))
349count
350+2
351choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
352choice
353+4, +2
354choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
355choice
356+4, +3
357
358array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
359array
360+5, +2, +5, +14, +12, +12, +5, +19
361choice = [getChoice(array)]
362choice
363+5
364count = getUnifRand(1, size(array))
365count
366+3
367choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
368choice
369+5, +5, +19
370choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
371choice
372+5, +14, +2
373
374array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
375array
376+19, +5, +19, +12, +4, +15
377choice = [getChoice(array)]
378choice
379+12
380count = getUnifRand(1, size(array))
381count
382+4
383choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
384choice
385+12, +19, +4, +5
386choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
387choice
388+12, +5, +15, +19
389
390array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
391array
392+8, +4, +10, +12, +5, +13, +19, +8
393choice = [getChoice(array)]
394choice
395+8
396count = getUnifRand(1, size(array))
397count
398+5
399choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
400choice
401+8, +4, +13, +8, +5
402choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
403choice
404+12, +5, +19, +4, +8
405
406array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
407array
408+8, +11, +17, +1
409choice = [getChoice(array)]
410choice
411+17
412count = getUnifRand(1, size(array))
413count
414+3
415choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
416choice
417+1, +1, +17
418choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
419choice
420+8, +11, +1
421
422array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
423array
424+18, +3, +8, +15, +6, +6, +17, +20, +3, +19
425choice = [getChoice(array)]
426choice
427+15
428count = getUnifRand(1, size(array))
429count
430+9
431choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
432choice
433+8, +3, +3, +3, +3, +6, +3, +6, +6
434choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
435choice
436+3, +17, +8, +6, +20, +19, +15, +6, +3
437
438array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
439array
440+6, +17, +4, +13, +7, +6, +7, +20, +13
441choice = [getChoice(array)]
442choice
443+20
444count = getUnifRand(1, size(array))
445count
446+4
447choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
448choice
449+13, +7, +13, +13
450choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
451choice
452+17, +13, +13, +6
453
454array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
455array
456+5, +5, +12, +9
457choice = [getChoice(array)]
458choice
459+5
460count = getUnifRand(1, size(array))
461count
462+4
463choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
464choice
465+9, +9, +9, +5
466choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
467choice
468+5, +12, +5, +9
469
470array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
471array
472+1, +17, +15, +20, +5, +5, +10, +8
473choice = [getChoice(array)]
474choice
475+10
476count = getUnifRand(1, size(array))
477count
478+5
479choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
480choice
481+5, +10, +17, +1, +20
482choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
483choice
484+5, +8, +1, +20, +17
485
486array = getUnifRand(1, 20, getUnifRand(4, 10)) ! generate random array for illustration.
487array
488+2, +10, +5, +17, +17, +3, +18, +14
489choice = [getChoice(array)]
490choice
491+3
492count = getUnifRand(1, size(array))
493count
494+6
495choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
496choice
497+17, +17, +5, +17, +10, +2
498choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
499choice
500+17, +2, +10, +3, +17, +5
501
502array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
503array
504F, T, F, F, F
505choice = [getChoice(array)]
506choice
507F
508count = getUnifRand(1, size(array))
509count
510+3
511choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
512choice
513F, F, T
514choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
515choice
516F, F, F
517
518array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
519array
520F, T, T, T
521choice = [getChoice(array)]
522choice
523T
524count = getUnifRand(1, size(array))
525count
526+3
527choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
528choice
529T, T, T
530choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
531choice
532T, T, T
533
534array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
535array
536F, T, T, F, T, F, F, T
537choice = [getChoice(array)]
538choice
539T
540count = getUnifRand(1, size(array))
541count
542+4
543choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
544choice
545T, F, F, T
546choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
547choice
548T, F, T, F
549
550array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
551array
552T, F, T, F, F, F
553choice = [getChoice(array)]
554choice
555T
556count = getUnifRand(1, size(array))
557count
558+6
559choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
560choice
561F, F, F, F, T, T
562choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
563choice
564F, F, T, F, T, F
565
566array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
567array
568F, F, F, F, T, F, F
569choice = [getChoice(array)]
570choice
571F
572count = getUnifRand(1, size(array))
573count
574+5
575choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
576choice
577F, F, F, T, T
578choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
579choice
580T, F, F, F, F
581
582array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
583array
584T, F, F, T, T
585choice = [getChoice(array)]
586choice
587T
588count = getUnifRand(1, size(array))
589count
590+4
591choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
592choice
593T, F, T, F
594choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
595choice
596F, F, T, T
597
598array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
599array
600F, F, T, T, T, T, F, F, T
601choice = [getChoice(array)]
602choice
603F
604count = getUnifRand(1, size(array))
605count
606+7
607choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
608choice
609T, T, F, T, T, T, T
610choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
611choice
612T, T, T, T, F, F, T
613
614array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
615array
616T, F, F, T, T
617choice = [getChoice(array)]
618choice
619F
620count = getUnifRand(1, size(array))
621count
622+3
623choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
624choice
625T, F, F
626choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
627choice
628T, T, F
629
630array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
631array
632F, F, T, T, T, T, F, T
633choice = [getChoice(array)]
634choice
635T
636count = getUnifRand(1, size(array))
637count
638+1
639choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
640choice
641F
642choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
643choice
644T
645
646array = getUnifRand(.false., .true., getUnifRand(4, 10)) ! generate random array for illustration.
647array
648T, F, F, T, T, T, T, T, T, T
649choice = [getChoice(array)]
650choice
651T
652count = getUnifRand(1, size(array))
653count
654+9
655choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
656choice
657F, T, T, T, T, F, T, F, T
658choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
659choice
660T, T, F, F, T, T, T, T, T
661
662array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
663array
664(+0.829858661, +0.267763913), (+0.529085100, +0.349018037), (+0.849642456, +0.321421742), (+0.302778840, +0.873203993), (+0.866684139, +0.681529999), (+0.929947495, +0.692473829), (+0.693464875E-1, +0.963464797), (+0.139425695, +0.190955937), (+0.836350083, +0.681445301), (+0.975634813, +0.921015620)
665choice = [getChoice(array)]
666choice
667(+0.836350083, +0.681445301)
668count = getUnifRand(1, size(array))
669count
670+5
671choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
672choice
673(+0.829858661, +0.267763913), (+0.836350083, +0.681445301), (+0.866684139, +0.681529999), (+0.829858661, +0.267763913), (+0.975634813, +0.921015620)
674choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
675choice
676(+0.975634813, +0.921015620), (+0.139425695, +0.190955937), (+0.529085100, +0.349018037), (+0.302778840, +0.873203993), (+0.849642456, +0.321421742)
677
678array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
679array
680(+0.713855803, +0.851756096), (+0.867268562, +0.924162507), (+0.382166445, +0.117221475E-1), (+0.111862183, +0.299321115), (+0.845844805, +0.692292690)
681choice = [getChoice(array)]
682choice
683(+0.111862183, +0.299321115)
684count = getUnifRand(1, size(array))
685count
686+3
687choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
688choice
689(+0.713855803, +0.851756096), (+0.713855803, +0.851756096), (+0.845844805, +0.692292690)
690choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
691choice
692(+0.111862183, +0.299321115), (+0.382166445, +0.117221475E-1), (+0.867268562, +0.924162507)
693
694array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
695array
696(+0.115364313, +0.985218287), (+0.651735365, +0.787932277), (+0.173790276, +0.860484958), (+0.718512714, +0.648005426), (+0.567487240, +0.820411205)
697choice = [getChoice(array)]
698choice
699(+0.718512714, +0.648005426)
700count = getUnifRand(1, size(array))
701count
702+2
703choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
704choice
705(+0.115364313, +0.985218287), (+0.718512714, +0.648005426)
706choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
707choice
708(+0.651735365, +0.787932277), (+0.115364313, +0.985218287)
709
710array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
711array
712(+0.221827686, +0.474248886), (+0.435820341, +0.203027129), (+0.340126574, +0.419395804), (+0.642032564, +0.903647542E-1), (+0.413459003, +0.521412075), (+0.367848158, +0.555348873), (+0.228453219, +0.623595297), (+0.261168122, +0.752192736), (+0.374186456, +0.241539478E-1)
713choice = [getChoice(array)]
714choice
715(+0.221827686, +0.474248886)
716count = getUnifRand(1, size(array))
717count
718+6
719choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
720choice
721(+0.367848158, +0.555348873), (+0.261168122, +0.752192736), (+0.228453219, +0.623595297), (+0.340126574, +0.419395804), (+0.340126574, +0.419395804), (+0.261168122, +0.752192736)
722choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
723choice
724(+0.221827686, +0.474248886), (+0.413459003, +0.521412075), (+0.367848158, +0.555348873), (+0.340126574, +0.419395804), (+0.435820341, +0.203027129), (+0.374186456, +0.241539478E-1)
725
726array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
727array
728(+0.812198997, +0.718210340E-1), (+0.431903005, +0.778924167), (+0.292096615, +0.904151499), (+0.151786983, +0.845342994), (+0.974624872, +0.334650993), (+0.634096265E-1, +0.429285347), (+0.942199230, +0.578120351), (+0.297524393, +0.229313552), (+0.765276730, +0.158325970)
729choice = [getChoice(array)]
730choice
731(+0.151786983, +0.845342994)
732count = getUnifRand(1, size(array))
733count
734+7
735choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
736choice
737(+0.942199230, +0.578120351), (+0.765276730, +0.158325970), (+0.634096265E-1, +0.429285347), (+0.292096615, +0.904151499), (+0.974624872, +0.334650993), (+0.942199230, +0.578120351), (+0.431903005, +0.778924167)
738choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
739choice
740(+0.634096265E-1, +0.429285347), (+0.942199230, +0.578120351), (+0.151786983, +0.845342994), (+0.765276730, +0.158325970), (+0.431903005, +0.778924167), (+0.297524393, +0.229313552), (+0.812198997, +0.718210340E-1)
741
742array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
743array
744(+0.683761597, +0.580815494), (+0.753095746E-1, +0.754745126), (+0.875243425, +0.799530566), (+0.444758415, +0.420462489E-1), (+0.352957249E-1, +0.381797194), (+0.298699260, +0.542954147)
745choice = [getChoice(array)]
746choice
747(+0.683761597, +0.580815494)
748count = getUnifRand(1, size(array))
749count
750+6
751choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
752choice
753(+0.444758415, +0.420462489E-1), (+0.683761597, +0.580815494), (+0.683761597, +0.580815494), (+0.352957249E-1, +0.381797194), (+0.683761597, +0.580815494), (+0.753095746E-1, +0.754745126)
754choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
755choice
756(+0.444758415, +0.420462489E-1), (+0.753095746E-1, +0.754745126), (+0.352957249E-1, +0.381797194), (+0.683761597, +0.580815494), (+0.298699260, +0.542954147), (+0.875243425, +0.799530566)
757
758array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
759array
760(+0.501194656, +0.252003491), (+0.134201169, +0.379255474), (+0.956518412, +0.103645444), (+0.668818831, +0.380728304), (+0.691480041E-1, +0.498371899), (+0.287643671, +0.631754339), (+0.257732272E-1, +0.561269462), (+0.612690449, +0.274081409)
761choice = [getChoice(array)]
762choice
763(+0.612690449, +0.274081409)
764count = getUnifRand(1, size(array))
765count
766+6
767choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
768choice
769(+0.501194656, +0.252003491), (+0.287643671, +0.631754339), (+0.134201169, +0.379255474), (+0.612690449, +0.274081409), (+0.668818831, +0.380728304), (+0.501194656, +0.252003491)
770choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
771choice
772(+0.956518412, +0.103645444), (+0.668818831, +0.380728304), (+0.501194656, +0.252003491), (+0.134201169, +0.379255474), (+0.691480041E-1, +0.498371899), (+0.287643671, +0.631754339)
773
774array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
775array
776(+0.908526182, +0.994800985), (+0.100652635, +0.108727276), (+0.833495796, +0.822975993), (+0.713514924, +0.565263927), (+0.924299181, +0.252061963), (+0.352035582, +0.570716619), (+0.471750498E-1, +0.945010543), (+0.754606903, +0.272570968)
777choice = [getChoice(array)]
778choice
779(+0.908526182, +0.994800985)
780count = getUnifRand(1, size(array))
781count
782+6
783choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
784choice
785(+0.100652635, +0.108727276), (+0.754606903, +0.272570968), (+0.754606903, +0.272570968), (+0.833495796, +0.822975993), (+0.713514924, +0.565263927), (+0.471750498E-1, +0.945010543)
786choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
787choice
788(+0.713514924, +0.565263927), (+0.924299181, +0.252061963), (+0.100652635, +0.108727276), (+0.471750498E-1, +0.945010543), (+0.754606903, +0.272570968), (+0.908526182, +0.994800985)
789
790array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
791array
792(+0.829946935, +0.486330330), (+0.340456784, +0.328087866), (+0.410145640, +0.572275519), (+0.366678119, +0.580553472), (+0.404899716, +0.679876208)
793choice = [getChoice(array)]
794choice
795(+0.404899716, +0.679876208)
796count = getUnifRand(1, size(array))
797count
798+2
799choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
800choice
801(+0.404899716, +0.679876208), (+0.829946935, +0.486330330)
802choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
803choice
804(+0.410145640, +0.572275519), (+0.829946935, +0.486330330)
805
806array = getUnifRand((0., 0.), (1., 1.), getUnifRand(4, 10)) ! generate random array for illustration.
807array
808(+0.726043463, +0.154740989), (+0.874337792, +0.586871326), (+0.478135347E-1, +0.751857758), (+0.616714716, +0.138562500), (+0.591071427, +0.193544030)
809choice = [getChoice(array)]
810choice
811(+0.726043463, +0.154740989)
812count = getUnifRand(1, size(array))
813count
814+1
815choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
816choice
817(+0.874337792, +0.586871326)
818choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
819choice
820(+0.874337792, +0.586871326)
821
822array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
823array
824+0.151437700, +0.713721275, +0.871247172, +0.574129641, +0.891952515E-1, +0.475979388, +0.662150145, +0.773222148, +0.460660696, +0.845793903
825choice = [getChoice(array)]
826choice
827+0.891952515E-1
828count = getUnifRand(1, size(array))
829count
830+2
831choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
832choice
833+0.773222148, +0.713721275
834choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
835choice
836+0.574129641, +0.151437700
837
838array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
839array
840+0.541724741, +0.999411762, +0.410857558, +0.588201344, +0.785782039
841choice = [getChoice(array)]
842choice
843+0.999411762
844count = getUnifRand(1, size(array))
845count
846+1
847choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
848choice
849+0.785782039
850choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
851choice
852+0.541724741
853
854array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
855array
856+0.607055664, +0.998507917, +0.912506819, +0.925973356, +0.847198069, +0.834653616, +0.187986493, +0.725230157
857choice = [getChoice(array)]
858choice
859+0.187986493
860count = getUnifRand(1, size(array))
861count
862+5
863choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
864choice
865+0.912506819, +0.725230157, +0.925973356, +0.187986493, +0.925973356
866choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
867choice
868+0.998507917, +0.725230157, +0.607055664, +0.187986493, +0.834653616
869
870array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
871array
872+0.174621582, +0.750187159, +0.167156518, +0.315299988, +0.288544953, +0.312615275, +0.919840395, +0.723774314, +0.707612574
873choice = [getChoice(array)]
874choice
875+0.723774314
876count = getUnifRand(1, size(array))
877count
878+4
879choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
880choice
881+0.174621582, +0.919840395, +0.919840395, +0.167156518
882choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
883choice
884+0.312615275, +0.174621582, +0.723774314, +0.315299988
885
886array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
887array
888+0.568120480E-1, +0.602263987, +0.509037375, +0.220255017, +0.679853320, +0.836914778, +0.815643430
889choice = [getChoice(array)]
890choice
891+0.679853320
892count = getUnifRand(1, size(array))
893count
894+6
895choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
896choice
897+0.836914778, +0.815643430, +0.509037375, +0.815643430, +0.220255017, +0.602263987
898choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
899choice
900+0.568120480E-1, +0.509037375, +0.679853320, +0.815643430, +0.220255017, +0.602263987
901
902array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
903array
904+0.423043132, +0.622403324, +0.729285359, +0.225710630, +0.249660671, +0.371677876E-1, +0.273165226, +0.829929769, +0.717950046
905choice = [getChoice(array)]
906choice
907+0.423043132
908count = getUnifRand(1, size(array))
909count
910+5
911choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
912choice
913+0.273165226, +0.225710630, +0.371677876E-1, +0.371677876E-1, +0.225710630
914choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
915choice
916+0.371677876E-1, +0.423043132, +0.225710630, +0.829929769, +0.249660671
917
918array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
919array
920+0.654447138, +0.333581388, +0.365495622, +0.274104476E-1, +0.752946019, +0.409405589, +0.186376750
921choice = [getChoice(array)]
922choice
923+0.409405589
924count = getUnifRand(1, size(array))
925count
926+4
927choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
928choice
929+0.409405589, +0.409405589, +0.409405589, +0.333581388
930choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
931choice
932+0.274104476E-1, +0.365495622, +0.333581388, +0.409405589
933
934array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
935array
936+0.229230821, +0.122754157, +0.774231911, +0.391770005, +0.274358511, +0.213502169, +0.130721450, +0.330404758, +0.529936612
937choice = [getChoice(array)]
938choice
939+0.529936612
940count = getUnifRand(1, size(array))
941count
942+7
943choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
944choice
945+0.130721450, +0.122754157, +0.130721450, +0.229230821, +0.229230821, +0.229230821, +0.213502169
946choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
947choice
948+0.330404758, +0.774231911, +0.391770005, +0.213502169, +0.274358511, +0.130721450, +0.229230821
949
950array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
951array
952+0.338760376, +0.705824494, +0.387342572E-1, +0.472192466, +0.523252845, +0.769931793, +0.189214647, +0.952345788, +0.685299873, +0.127488852
953choice = [getChoice(array)]
954choice
955+0.705824494
956count = getUnifRand(1, size(array))
957count
958+7
959choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
960choice
961+0.189214647, +0.705824494, +0.472192466, +0.387342572E-1, +0.472192466, +0.338760376, +0.387342572E-1
962choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
963choice
964+0.705824494, +0.472192466, +0.952345788, +0.387342572E-1, +0.685299873, +0.523252845, +0.189214647
965
966array = getUnifRand(0., 1., getUnifRand(4, 10)) ! generate random array for illustration.
967array
968+0.994390547, +0.217241764, +0.109921217, +0.246933997, +0.682119727, +0.653892875
969choice = [getChoice(array)]
970choice
971+0.994390547
972count = getUnifRand(1, size(array))
973count
974+4
975choice = getChoice(array, count) ! draw randomly only `count` elements with replacement.
976choice
977+0.246933997, +0.653892875, +0.246933997, +0.682119727
978choice = getChoice(array, count, unique = .true._LK) ! draw randomly only `count` elements without replacement.
979choice
980+0.653892875, +0.994390547, +0.246933997, +0.217241764
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: