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+1
5call setResized(change, count)
6call setChange(rng, change, start, stop, step)
7change
8"A"
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+10
21call setResized(change, count)
22call setChange(rng, change, start, stop, step)
23change
24"AFCDAEDDEB"
25
26count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
27count
28+6
29call setResized(change, count)
30call setChange(rng, change, start, stop, step, unique = .true._LK)
31change
32"BFDCAE"
33
34count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
35count
36+7
37call setResized(change, count)
38call setChange(rng, change, start, stop, step, unique = .true._LK)
39change
40"Y\kqzVn"
41
42count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
43count
44+3
45call setResized(change, count)
46call setChange(rng, change, start, stop, step)
47change
48"ECC"
49
50count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
51count
52+1
53call setResized(change, count)
54call setChange(rng, change, start, stop, step, unique = .true._LK)
55change
56"F"
57
58count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
59count
60+5
61call setResized(change, count)
62call setChange(rng, change, start, stop, step, unique = .true._LK)
63change
64"DSP_h"
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"DCCADCFB"
73
74count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
75count
76+1
77call setResized(change, count)
78call setChange(rng, change, start, stop, step, unique = .true._LK)
79change
80"B"
81
82count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
83count
84+8
85call setResized(change, count)
86call setChange(rng, change, start, stop, step, unique = .true._LK)
87change
88"VMk\bYhP"
89
90count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
91count
92+3
93call setResized(change, count)
94call setChange(rng, change, start, stop, step)
95change
96"DEE"
97
98count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
99count
100+6
101call setResized(change, count)
102call setChange(rng, change, start, stop, step, unique = .true._LK)
103change
104"BCDEFA"
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"kAqDJwM"
113
114count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
115count
116+3
117call setResized(change, count)
118call setChange(rng, change, start, stop, step)
119change
120"EEB"
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"BACFD"
129
130count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
131count
132+10
133call setResized(change, count)
134call setChange(rng, change, start, stop, step, unique = .true._LK)
135change
136"SqGAwk\hPz"
137
138count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
139count
140+6
141call setResized(change, count)
142call setChange(rng, change, start, stop, step)
143change
144"BEEDBF"
145
146count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
147count
148+5
149call setResized(change, count)
150call setChange(rng, change, start, stop, step, unique = .true._LK)
151change
152"CEABD"
153
154count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
155count
156+7
157call setResized(change, count)
158call setChange(rng, change, start, stop, step, unique = .true._LK)
159change
160"k_PwDMz"
161
162count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
163count
164+5
165call setResized(change, count)
166call setChange(rng, change, start, stop, step)
167change
168"FEDCF"
169
170count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
171count
172+3
173call setResized(change, count)
174call setChange(rng, change, start, stop, step, unique = .true._LK)
175change
176"ACD"
177
178count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
179count
180+6
181call setResized(change, count)
182call setChange(rng, change, start, stop, step, unique = .true._LK)
183change
184"PnYwAe"
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"AAFDBDBAAD"
193
194count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
195count
196+5
197call setResized(change, count)
198call setChange(rng, change, start, stop, step, unique = .true._LK)
199change
200"BCADF"
201
202count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
203count
204+5
205call setResized(change, count)
206call setChange(rng, change, start, stop, step, unique = .true._LK)
207change
208"wD_Y\"
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"DFEECACCDC"
217
218count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
219count
220+5
221call setResized(change, count)
222call setChange(rng, change, start, stop, step, unique = .true._LK)
223change
224"ECBFD"
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"J\Geb"
233
234count = getUnifRand(1, 10); start = 'A'; stop = 'F'; step = 1
235count
236+4
237call setResized(change, count)
238call setChange(rng, change, start, stop, step)
239change
240"FACA"
241
242count = getUnifRand(1, 6); start = 'F'; stop = 'A'; step = -1
243count
244+6
245call setResized(change, count)
246call setChange(rng, change, start, stop, step, unique = .true._LK)
247change
248"BCAFDE"
249
250count = getUnifRand(5, 10); start = 'A'; stop = 'z'; step = 3
251count
252+8
253call setResized(change, count)
254call setChange(rng, change, start, stop, step, unique = .true._LK)
255change
256"M\YwhtPb"
257
258count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
259count
260+2
261if (allocated(change)) deallocate(change); allocate(change(count))
262call setChange(rng, change, start, stop, step)
263change
264"+6", "+2"
265
266count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
267count
268+5
269if (allocated(change)) deallocate(change); allocate(change(count))
270call setChange(rng, change, start, stop, step, unique = .true._LK)
271change
272"-5", "-9", "-1", "+1", "+7"
273
274count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
275count
276+12
277if (allocated(change)) deallocate(change); allocate(change(count))
278call setChange(rng, change, start, stop, step, unique = .false._LK)
279change
280"+1", "+1", "+5", "+5", "+3", "+5", "+5", "+5", "+1", "+3", "+5", "+3"
281
282count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
283count
284+3
285if (allocated(change)) deallocate(change); allocate(change(count))
286call setChange(rng, change, start, stop, step)
287change
288"+4", "+7", "+9"
289
290count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
291count
292+6
293if (allocated(change)) deallocate(change); allocate(change(count))
294call setChange(rng, change, start, stop, step, unique = .true._LK)
295change
296"+9", "+5", "+3", "+1", "-9", "+7"
297
298count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
299count
300+15
301if (allocated(change)) deallocate(change); allocate(change(count))
302call setChange(rng, change, start, stop, step, unique = .false._LK)
303change
304"+3", "+1", "+5", "+3", "+1", "+1", "+3", "+3", "+3", "+3", "+1", "+5", "+5", "+1", "+1"
305
306count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
307count
308+8
309if (allocated(change)) deallocate(change); allocate(change(count))
310call setChange(rng, change, start, stop, step)
311change
312"+9", "+7", "+6", "+8", "+2", "+2", "+5", "+2"
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"+9", "-7", "-3", "+5", "+7", "+3", "-1", "-5", "+1"
321
322count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
323count
324+6
325if (allocated(change)) deallocate(change); allocate(change(count))
326call setChange(rng, change, start, stop, step, unique = .false._LK)
327change
328"+1", "+1", "+3", "+1", "+1", "+1"
329
330count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
331count
332+8
333if (allocated(change)) deallocate(change); allocate(change(count))
334call setChange(rng, change, start, stop, step)
335change
336"+4", "+1", "+6", "+4", "+0", "+3", "+3", "+2"
337
338count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
339count
340+6
341if (allocated(change)) deallocate(change); allocate(change(count))
342call setChange(rng, change, start, stop, step, unique = .true._LK)
343change
344"+9", "+1", "-1", "+5", "+3", "-5"
345
346count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
347count
348+8
349if (allocated(change)) deallocate(change); allocate(change(count))
350call setChange(rng, change, start, stop, step, unique = .false._LK)
351change
352"+3", "+5", "+3", "+1", "+5", "+1", "+3", "+3"
353
354count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
355count
356+1
357if (allocated(change)) deallocate(change); allocate(change(count))
358call setChange(rng, change, start, stop, step)
359change
360"+5"
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"+1", "-3", "+5", "-1", "-7", "-9", "+9", "+3", "-5", "+7"
369
370count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
371count
372+8
373if (allocated(change)) deallocate(change); allocate(change(count))
374call setChange(rng, change, start, stop, step, unique = .false._LK)
375change
376"+1", "+1", "+5", "+3", "+1", "+5", "+3", "+5"
377
378count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
379count
380+9
381if (allocated(change)) deallocate(change); allocate(change(count))
382call setChange(rng, change, start, stop, step)
383change
384"+9", "+5", "+0", "+4", "+3", "+5", "+3", "+7", "+5"
385
386count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
387count
388+6
389if (allocated(change)) deallocate(change); allocate(change(count))
390call setChange(rng, change, start, stop, step, unique = .true._LK)
391change
392"-9", "+1", "+5", "-1", "+3", "-5"
393
394count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
395count
396+12
397if (allocated(change)) deallocate(change); allocate(change(count))
398call setChange(rng, change, start, stop, step, unique = .false._LK)
399change
400"+1", "+1", "+5", "+5", "+1", "+3", "+3", "+1", "+5", "+1", "+5", "+5"
401
402count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
403count
404+1
405if (allocated(change)) deallocate(change); allocate(change(count))
406call setChange(rng, change, start, stop, step)
407change
408"+1"
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"+3", "+9", "-7", "-9", "-1", "+7", "-3", "+1", "-5", "+5"
417
418count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
419count
420+12
421if (allocated(change)) deallocate(change); allocate(change(count))
422call setChange(rng, change, start, stop, step, unique = .false._LK)
423change
424"+5", "+3", "+1", "+1", "+5", "+1", "+5", "+3", "+5", "+5", "+5", "+1"
425
426count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
427count
428+10
429if (allocated(change)) deallocate(change); allocate(change(count))
430call setChange(rng, change, start, stop, step)
431change
432"+3", "+0", "+5", "+3", "+4", "+6", "+7", "+2", "+0", "+3"
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"+1", "+9", "-1", "+5", "+7", "-5", "-7", "-3", "+3"
441
442count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
443count
444+6
445if (allocated(change)) deallocate(change); allocate(change(count))
446call setChange(rng, change, start, stop, step, unique = .false._LK)
447change
448"+5", "+3", "+1", "+1", "+3", "+5"
449
450count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
451count
452+9
453if (allocated(change)) deallocate(change); allocate(change(count))
454call setChange(rng, change, start, stop, step)
455change
456"+9", "+9", "+6", "+7", "+7", "+7", "+5", "+0", "+5"
457
458count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
459count
460+10
461if (allocated(change)) deallocate(change); allocate(change(count))
462call setChange(rng, change, start, stop, step, unique = .true._LK)
463change
464"-1", "-7", "+5", "+9", "-9", "+3", "+1", "+7", "-5", "-3"
465
466count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
467count
468+14
469if (allocated(change)) deallocate(change); allocate(change(count))
470call setChange(rng, change, start, stop, step, unique = .false._LK)
471change
472"+3", "+1", "+5", "+3", "+1", "+1", "+5", "+3", "+1", "+1", "+1", "+1", "+1", "+3"
473
474count = getUnifRand(1, 10); start = 0; stop = 9; step = 1
475count
476+4
477if (allocated(change)) deallocate(change); allocate(change(count))
478call setChange(rng, change, start, stop, step)
479change
480"+8", "+2", "+8", "+2"
481
482count = getUnifRand(5, 10); start = 9; stop = -9; step = -2
483count
484+5
485if (allocated(change)) deallocate(change); allocate(change(count))
486call setChange(rng, change, start, stop, step, unique = .true._LK)
487change
488"+3", "-9", "-5", "-1", "-3"
489
490count = getUnifRand(5, 15); start = 5; stop = 1; step = -2
491count
492+11
493if (allocated(change)) deallocate(change); allocate(change(count))
494call setChange(rng, change, start, stop, step, unique = .false._LK)
495change
496"+1", "+5", "+1", "+3", "+3", "+3", "+3", "+3", "+5", "+5", "+5"
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: