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

Return a randomly-uniform uniquely-selected sequence of elements from a scalar character or integer range specified via the input limits [start, stop].
More...

Detailed Description

Return a randomly-uniform uniquely-selected sequence of elements from a scalar character or integer range specified via the input limits [start, stop].

The length of the output sequence must be smaller than or equal to the specified range as [start, stop] to ensure uniqueness of elements.
The case of length of the output sequence being equal to the length of the specified range [start, stop] is equivalent to a random shuffling of all values within the specified range.

Parameters
[in,out]rng: The input/output scalar that can be an object of,
  1. type rngf_type, implying the use of intrinsic Fortran uniform RNG.
  2. type xoshiro256ssw_type, implying the use of xoshiro256** uniform RNG.
[out]change: The output vector of shape (:),
  1. type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64),
or a scalar of,
  1. type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU),
whose elements are uniformly randomly selected from within the specified range as [start, stop].
The length/size of change must be smaller than or equal to the length of the range specified by [start, stop].
[in]start: The input scalar of the same type and kind as the output change containing the lower limit of the range from which element(s) will be selected randomly and returned in the output change.
If start is of type character, then it must be of length type parameter 1.
[in]step: The non-zero input scalar of type integer representing the size of the interval between adjacent values in the output change.
  1. If change is of type character, then step must have the default integer kind IK.
  2. If change is of type integer, then step must have the same type kind parameter as the output change.
If stop is of type character, then it must be of length type parameter 1.
[in]unique: The input scalar logical of default kind LK.
If .true., the elements of the output change will be uniquely selected from the input array.
If unique = .true., the condition count <= len(getRange(start, stop, step)) or count <= size(getRange(start, stop, step)) must hold to ensure uniqueness of the elements of the output sequence.
(optional, default = .false._LK)


Possible calling interfaces

change = setChange(rng, change, start, stop, step, unique = unique)
Return a randomly-uniform uniquely-selected sequence of elements from a scalar character or integer r...
This module contains procedures and generic interfaces for selecting uniformly-distributed random cho...
Warning
All warnings and conditions associated with getRange(start, stop, step) and setChoice(start, stop, step) equally hold for the procedures of this generic interface.
The length of the resulting sequence from the specified range (start, stop, step) must not be zero.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
Remarks
The procedures under discussion are impure. The procedures of this generic interface are pure when the library is built with preprocessor macro CHECK_ENABLED=0 and the input argument rng is set to an object of type xoshiro256ssw_type.
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_arrayChoice, only: getChoice
11 use pm_distUnif, only: getUnifRand
13 use pm_arrayResize, only: setResized
14 use pm_arrayChange, only: setChange
15
16 implicit none
17
18 type(xoshiro256ssw_type) :: rng
19 integer(IK) :: count, itry, ntry = 10
20 type(display_type) :: disp
21 disp = display_type(file = "main.out.F90")
22
23 rng = xoshiro256ssw_type()
24
25 block
26 integer(IK) :: step
27 character(:), allocatable :: start, stop, change
28
29 do itry = 1, 2
30 call disp%skip
31 call disp%show("count = getChoice([1, 2]); start = 'A'; stop = 'A'; step = getChoice([-1, 1])")
32 count = getChoice([1, 2]); start = 'A'; stop = 'A'; step = getChoice([-1, 1])
33 call disp%show("count")
34 call disp%show( count )
35 call disp%show("call setResized(change, count)")
36 call setResized(change, count)
37 call disp%show("call setChange(rng, change, start, stop, step)")
38 call setChange(rng, change, start, stop, step)
39 call disp%show("change")
40 call disp%show( change, deliml = SK_"""" )
41 end do
42
43 do itry = 1, ntry
44
45 call disp%skip
46 call disp%show("count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1")
47 count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
48 call disp%show("count")
49 call disp%show( count )
50 call disp%show("call setResized(change, count)")
51 call setResized(change, count)
52 call disp%show("call setChange(rng, change, start, stop, step)")
53 call setChange(rng, change, start, stop, step)
54 call disp%show("change")
55 call disp%show( change, deliml = SK_"""" )
56
57 call disp%skip
58 call disp%show("count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1")
59 count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
60 call disp%show("count")
61 call disp%show( count )
62 call disp%show("call setResized(change, count)")
63 call setResized(change, count)
64 call disp%show("call setChange(rng, change, start, stop, step, unique = .true._LK)")
65 call setChange(rng, change, start, stop, step, unique = .true._LK)
66 call disp%show("change")
67 call disp%show( change, deliml = SK_"""" )
68
69 call disp%skip
70 call disp%show("count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3")
71 count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
72 call disp%show("count")
73 call disp%show( count )
74 call disp%show("call setResized(change, count)")
75 call setResized(change, count)
76 call disp%show("call setChange(rng, change, start, stop, step, unique = .true._LK)")
77 call setChange(rng, change, start, stop, step, unique = .true._LK)
78 call disp%show("change")
79 call disp%show( change, deliml = SK_"""" )
80
81 end do
82 end block
83
84 block
85 use pm_kind, only: IKG => IK ! all integer kinds are supported.
86 integer(IKG) :: step
87 integer(IKG), allocatable :: start, stop, change(:)
88 do itry = 1, ntry
89
90 call disp%skip
91 call disp%show("count = getUnifRand(1, 10); start = 0; stop = 9; step = 1")
92 count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
93 call disp%show("count")
94 call disp%show( count )
95 call disp%show("if (allocated(change)) deallocate(change); allocate(change(count))")
96 if (allocated(change)) deallocate(change); allocate(change(count))
97 call disp%show("call setChange(rng, change, start, stop, step)")
98 call setChange(rng, change, start, stop, step)
99 call disp%show("change")
100 call disp%show( change, deliml = SK_"""" )
101
102 call disp%skip
103 call disp%show("count = getUnifRand(5, 10); start = 9; stop = -9; step = -2")
104 count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
105 call disp%show("count")
106 call disp%show( count )
107 call disp%show("if (allocated(change)) deallocate(change); allocate(change(count))")
108 if (allocated(change)) deallocate(change); allocate(change(count))
109 call disp%show("call setChange(rng, change, start, stop, step, unique = .true._LK)")
110 call setChange(rng, change, start, stop, step, unique = .true._LK)
111 call disp%show("change")
112 call disp%show( change, deliml = SK_"""" )
113
114 call disp%skip
115 call disp%show("count = getUnifRand(5, 15); start = 5; stop = 1; step = -2")
116 count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
117 call disp%show("count")
118 call disp%show( count )
119 call disp%show("if (allocated(change)) deallocate(change); allocate(change(count))")
120 if (allocated(change)) deallocate(change); allocate(change(count))
121 call disp%show("call setChange(rng, change, start, stop, step, unique = .false._LK)")
122 call setChange(rng, change, start, stop, step, unique = .false._LK)
123 call disp%show("change")
124 call disp%show( change, deliml = SK_"""" )
125
126 end do
127 end block
128
129end program example
Select a single (or multiple) element(s) from the input array of intrinsic type of arbitrary kind ran...
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains procedures and generic interfaces for selecting uniformly-distributed or arbitra...
This module contains procedures and generic interfaces for generating ranges of discrete character,...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
Definition: pm_kind.F90:542
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
This is the derived type for declaring and generating objects of type xoshiro256ssw_type containing a...
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

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

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

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

Example output
1
2count = getChoice([1, 2]); start = 'A'; stop = 'A'; step = getChoice([-1, 1])
3count
4+2
5call setResized(change, count)
6call setChange(rng, change, start, stop, step)
7change
8"AA"
9
10count = getChoice([1, 2]); start = 'A'; stop = 'A'; step = getChoice([-1, 1])
11count
12+1
13call setResized(change, count)
14call setChange(rng, change, start, stop, step)
15change
16"A"
17
18count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
19count
20+4
21call setResized(change, count)
22call setChange(rng, change, start, stop, step)
23change
24"CFAB"
25
26count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
27count
28+4
29call setResized(change, count)
30call setChange(rng, change, start, stop, step, unique = .true._LK)
31change
32"CFAD"
33
34count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
35count
36+8
37call setResized(change, count)
38call setChange(rng, change, start, stop, step, unique = .true._LK)
39change
40"\PzJGnDw"
41
42count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
43count
44+4
45call setResized(change, count)
46call setChange(rng, change, start, stop, step)
47change
48"CAEF"
49
50count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
51count
52+2
53call setResized(change, count)
54call setChange(rng, change, start, stop, step, unique = .true._LK)
55change
56"BD"
57
58count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
59count
60+7
61call setResized(change, count)
62call setChange(rng, change, start, stop, step, unique = .true._LK)
63change
64"DwzhAM\"
65
66count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
67count
68+8
69call setResized(change, count)
70call setChange(rng, change, start, stop, step)
71change
72"EEECCCFA"
73
74count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
75count
76+4
77call setResized(change, count)
78call setChange(rng, change, start, stop, step, unique = .true._LK)
79change
80"FAED"
81
82count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
83count
84+7
85call setResized(change, count)
86call setChange(rng, change, start, stop, step, unique = .true._LK)
87change
88"PntkqD_"
89
90count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
91count
92+6
93call setResized(change, count)
94call setChange(rng, change, start, stop, step)
95change
96"DBFCAB"
97
98count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
99count
100+1
101call setResized(change, count)
102call setChange(rng, change, start, stop, step, unique = .true._LK)
103change
104"E"
105
106count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
107count
108+7
109call setResized(change, count)
110call setChange(rng, change, start, stop, step, unique = .true._LK)
111change
112"Se\VDPw"
113
114count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
115count
116+9
117call setResized(change, count)
118call setChange(rng, change, start, stop, step)
119change
120"EADAFBAEB"
121
122count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
123count
124+5
125call setResized(change, count)
126call setChange(rng, change, start, stop, step, unique = .true._LK)
127change
128"EAFCB"
129
130count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
131count
132+8
133call setResized(change, count)
134call setChange(rng, change, start, stop, step, unique = .true._LK)
135change
136"btq\DhnG"
137
138count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
139count
140+2
141call setResized(change, count)
142call setChange(rng, change, start, stop, step)
143change
144"CA"
145
146count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
147count
148+6
149call setResized(change, count)
150call setChange(rng, change, start, stop, step, unique = .true._LK)
151change
152"BADCFE"
153
154count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
155count
156+6
157call setResized(change, count)
158call setChange(rng, change, start, stop, step, unique = .true._LK)
159change
160"GPtJz_"
161
162count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
163count
164+7
165call setResized(change, count)
166call setChange(rng, change, start, stop, step)
167change
168"BDCECDD"
169
170count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
171count
172+2
173call setResized(change, count)
174call setChange(rng, change, start, stop, step, unique = .true._LK)
175change
176"FB"
177
178count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
179count
180+5
181call setResized(change, count)
182call setChange(rng, change, start, stop, step, unique = .true._LK)
183change
184"Gqn\z"
185
186count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
187count
188+10
189call setResized(change, count)
190call setChange(rng, change, start, stop, step)
191change
192"AFEBBDBEBC"
193
194count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
195count
196+2
197call setResized(change, count)
198call setChange(rng, change, start, stop, step, unique = .true._LK)
199change
200"EC"
201
202count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
203count
204+6
205call setResized(change, count)
206call setChange(rng, change, start, stop, step, unique = .true._LK)
207change
208"_MPDVn"
209
210count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
211count
212+10
213call setResized(change, count)
214call setChange(rng, change, start, stop, step)
215change
216"CEBDDFDDCE"
217
218count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
219count
220+1
221call setResized(change, count)
222call setChange(rng, change, start, stop, step, unique = .true._LK)
223change
224"F"
225
226count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
227count
228+5
229call setResized(change, count)
230call setChange(rng, change, start, stop, step, unique = .true._LK)
231change
232"\zMnV"
233
234count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
235count
236+5
237call setResized(change, count)
238call setChange(rng, change, start, stop, step)
239change
240"DFBBD"
241
242count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
243count
244+4
245call setResized(change, count)
246call setChange(rng, change, start, stop, step, unique = .true._LK)
247change
248"DCFE"
249
250count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
251count
252+5
253call setResized(change, count)
254call setChange(rng, change, start, stop, step, unique = .true._LK)
255change
256"AYVwD"
257
258count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
259count
260+8
261if (allocated(change)) deallocate(change); allocate(change(count))
262call setChange(rng, change, start, stop, step)
263change
264"+1", "+1", "+9", "+6", "+4", "+1", "+4", "+6"
265
266count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
267count
268+9
269if (allocated(change)) deallocate(change); allocate(change(count))
270call setChange(rng, change, start, stop, step, unique = .true._LK)
271change
272"-3", "+5", "+1", "+3", "+7", "-5", "-1", "-7", "+9"
273
274count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
275count
276+8
277if (allocated(change)) deallocate(change); allocate(change(count))
278call setChange(rng, change, start, stop, step, unique = .false._LK)
279change
280"+5", "+5", "+3", "+3", "+3", "+5", "+5", "+5"
281
282count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
283count
284+6
285if (allocated(change)) deallocate(change); allocate(change(count))
286call setChange(rng, change, start, stop, step)
287change
288"+7", "+4", "+2", "+8", "+7", "+6"
289
290count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
291count
292+7
293if (allocated(change)) deallocate(change); allocate(change(count))
294call setChange(rng, change, start, stop, step, unique = .true._LK)
295change
296"-5", "+9", "+3", "+1", "-1", "-7", "-9"
297
298count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
299count
300+12
301if (allocated(change)) deallocate(change); allocate(change(count))
302call setChange(rng, change, start, stop, step, unique = .false._LK)
303change
304"+1", "+3", "+3", "+5", "+1", "+1", "+3", "+5", "+3", "+5", "+3", "+1"
305
306count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
307count
308+6
309if (allocated(change)) deallocate(change); allocate(change(count))
310call setChange(rng, change, start, stop, step)
311change
312"+8", "+0", "+1", "+9", "+9", "+0"
313
314count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
315count
316+9
317if (allocated(change)) deallocate(change); allocate(change(count))
318call setChange(rng, change, start, stop, step, unique = .true._LK)
319change
320"+1", "+7", "+5", "-7", "-9", "-1", "+3", "-3", "+9"
321
322count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
323count
324+8
325if (allocated(change)) deallocate(change); allocate(change(count))
326call setChange(rng, change, start, stop, step, unique = .false._LK)
327change
328"+1", "+5", "+1", "+1", "+3", "+3", "+3", "+1"
329
330count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
331count
332+2
333if (allocated(change)) deallocate(change); allocate(change(count))
334call setChange(rng, change, start, stop, step)
335change
336"+9", "+8"
337
338count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
339count
340+9
341if (allocated(change)) deallocate(change); allocate(change(count))
342call setChange(rng, change, start, stop, step, unique = .true._LK)
343change
344"-7", "-9", "-3", "+1", "+7", "-1", "+3", "-5", "+9"
345
346count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
347count
348+14
349if (allocated(change)) deallocate(change); allocate(change(count))
350call setChange(rng, change, start, stop, step, unique = .false._LK)
351change
352"+5", "+1", "+5", "+3", "+3", "+5", "+5", "+5", "+1", "+5", "+1", "+1", "+5", "+5"
353
354count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
355count
356+9
357if (allocated(change)) deallocate(change); allocate(change(count))
358call setChange(rng, change, start, stop, step)
359change
360"+7", "+3", "+9", "+8", "+9", "+5", "+5", "+7", "+8"
361
362count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
363count
364+10
365if (allocated(change)) deallocate(change); allocate(change(count))
366call setChange(rng, change, start, stop, step, unique = .true._LK)
367change
368"-5", "+7", "-9", "-7", "-3", "+1", "+3", "-1", "+5", "+9"
369
370count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
371count
372+13
373if (allocated(change)) deallocate(change); allocate(change(count))
374call setChange(rng, change, start, stop, step, unique = .false._LK)
375change
376"+5", "+1", "+1", "+1", "+1", "+3", "+1", "+3", "+5", "+3", "+1", "+3", "+5"
377
378count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
379count
380+4
381if (allocated(change)) deallocate(change); allocate(change(count))
382call setChange(rng, change, start, stop, step)
383change
384"+3", "+3", "+7", "+2"
385
386count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
387count
388+5
389if (allocated(change)) deallocate(change); allocate(change(count))
390call setChange(rng, change, start, stop, step, unique = .true._LK)
391change
392"+9", "-5", "+5", "+3", "+1"
393
394count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
395count
396+5
397if (allocated(change)) deallocate(change); allocate(change(count))
398call setChange(rng, change, start, stop, step, unique = .false._LK)
399change
400"+5", "+1", "+5", "+3", "+5"
401
402count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
403count
404+7
405if (allocated(change)) deallocate(change); allocate(change(count))
406call setChange(rng, change, start, stop, step)
407change
408"+9", "+4", "+4", "+3", "+0", "+5", "+8"
409
410count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
411count
412+10
413if (allocated(change)) deallocate(change); allocate(change(count))
414call setChange(rng, change, start, stop, step, unique = .true._LK)
415change
416"-9", "+1", "-1", "-5", "+7", "+9", "+3", "+5", "-7", "-3"
417
418count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
419count
420+9
421if (allocated(change)) deallocate(change); allocate(change(count))
422call setChange(rng, change, start, stop, step, unique = .false._LK)
423change
424"+3", "+1", "+5", "+1", "+5", "+3", "+1", "+5", "+1"
425
426count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
427count
428+8
429if (allocated(change)) deallocate(change); allocate(change(count))
430call setChange(rng, change, start, stop, step)
431change
432"+4", "+1", "+0", "+6", "+8", "+8", "+8", "+4"
433
434count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
435count
436+9
437if (allocated(change)) deallocate(change); allocate(change(count))
438call setChange(rng, change, start, stop, step, unique = .true._LK)
439change
440"+5", "+9", "+3", "-9", "-3", "+7", "-7", "-1", "-5"
441
442count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
443count
444+7
445if (allocated(change)) deallocate(change); allocate(change(count))
446call setChange(rng, change, start, stop, step, unique = .false._LK)
447change
448"+1", "+3", "+3", "+5", "+5", "+3", "+5"
449
450count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
451count
452+6
453if (allocated(change)) deallocate(change); allocate(change(count))
454call setChange(rng, change, start, stop, step)
455change
456"+4", "+3", "+1", "+8", "+7", "+2"
457
458count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
459count
460+9
461if (allocated(change)) deallocate(change); allocate(change(count))
462call setChange(rng, change, start, stop, step, unique = .true._LK)
463change
464"-1", "-9", "-5", "+5", "+9", "+7", "-7", "-3", "+1"
465
466count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
467count
468+9
469if (allocated(change)) deallocate(change); allocate(change(count))
470call setChange(rng, change, start, stop, step, unique = .false._LK)
471change
472"+1", "+3", "+3", "+5", "+3", "+1", "+5", "+1", "+3"
473
474count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
475count
476+8
477if (allocated(change)) deallocate(change); allocate(change(count))
478call setChange(rng, change, start, stop, step)
479change
480"+3", "+9", "+1", "+6", "+8", "+1", "+2", "+1"
481
482count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
483count
484+9
485if (allocated(change)) deallocate(change); allocate(change(count))
486call setChange(rng, change, start, stop, step, unique = .true._LK)
487change
488"+5", "+1", "+3", "+7", "-9", "-7", "+9", "-3", "-5"
489
490count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
491count
492+15
493if (allocated(change)) deallocate(change); allocate(change(count))
494call setChange(rng, change, start, stop, step, unique = .false._LK)
495change
496"+3", "+3", "+1", "+3", "+3", "+5", "+5", "+1", "+1", "+1", "+3", "+3", "+1", "+1", "+3"
497
Test:
test_pm_arrayChange


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 448 of file pm_arrayChange.F90.


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