Return a uniform random scalar or contiguous
array of arbitrary rank of randomly uniformly distributed discrete logical
, integer
, character
value(s), or continuous real
or `complex value(s) within the specified input range.
- Parameters
-
[in,out] | rng | : The input/output scalar of type,
-
rngf_type, or
-
splitmix64_type, or
-
xoshiro256ssg_type,
-
xoshiro256ssw_type,
containing the user-specified random number generator algorithm to be used.
The user must initialize the object with the corresponding type constructors if non-deterministic RNG are desired. (optional, default = rngf_type) |
[out] | rand | : The output object of either
-
scalar of type
character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of arbitrary len type parameter or,
or contiguous array of the rank, shape, and size as other array-like arguments, of either
-
type
character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of arbitrary len type parameter or,
-
type
integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64) or,
-
type
complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128) or,
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) or,
-
type
logical of kind any supported by the processor (e.g., LK),
containing the uniformly-distributed random output value.
-
If
rand is of type logical , its value is either .false. or .true. .
-
If
rand is of type integer , its value is in the interval [lb, ub] .
-
If
rand is of type complex or real , its value is in the interval [lb, ub) .
-
If
rand is of type character , its value is by default in the interval [char(1), char(127)] .
|
[in] | lb | : The input scalar (or array of the same rank, shape, and size as other array-like arguments), of the same type and kind as rand , representing the lower bound of the Uniform distribution.
-
If
rand is of type character , then len(rand) == len(lb) must hold.
-
If
rand is of type logical , then lb must be .false. (there is no other possibility).
(optional, default = char(1) , repeat(char(1), len(rand)) , -huge(rand) , .false. , (0.,0.) , or 0. , for a scalar character , vector character , integer , complex , or real output rand , respectively.
It must be present if and only if ub is also present.) |
[in] | ub | : The input scalar (or array of the same shape as rand ) of the same type and kind as rand , representing the upper bound of the Uniform distribution.
If rand is of type character , then len(rand) == len(ub) must hold.
If rand is of type logical , then ub does not exist as an input argument (it must not be present).
(optional, default = char(127) , repeat(char(127), len(rand)) , +huge(rand) , .true. , (1.,1.) , or 1. , for a scalar character , vector character , integer , complex , or real output rand , respectively.
It must be present if and only if ub is also present.) |
Possible calling interfaces ⛓
!
Return a uniform random scalar or contiguous array of arbitrary rank of randomly uniformly distribute...
This module contains classes and procedures for computing various statistical quantities related to t...
- Warning
- The condition
len(lb) == len(ub) .or. len(lb) == 1 .or. len(ub) == 1
for the corresponding input arguments of type character
.
The condition lb <= ub
must hold for the corresponding input arguments where logical values are compared by the procedures of module pm_logicalCompare and complex values are compared by the procedures of module pm_complexCompareAll.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
- Note
- By default random characters are generated from the ASCII collating sequence to ensure portability across compilers and platforms.
If random uniform characters from the processor's collating sequence are desired, specify the lb
and ub
inputs argument as integer
s of default kind IK, such that the random numbers are generated from the processor-dependent character interval [char(lb), char(ub)]
.
- See also
- rngf
isHead
getUnifCDF
getUnifRand
setUnifRand
getUnifRandState
setUnifRandState
rngu_type
rngf_type
splitmix64_type
xoshiro256ssw_type
getUnifRandStateSize
Example usage ⛓
13 integer(IK) ,
parameter :: NP
= 5_IK
15 character(
5,SK) :: rand_D0_SK
16 character(
2,SK) :: rand_D1_SK(NP), rand_D2_SK(NP,NP)
17 logical(LK) :: rand_D0_LK, rand_D1_LK(NP), rand_D2_LK(NP,NP)
18 integer(IK) :: rand_D0_IK, rand_D1_IK(NP), rand_D2_IK(NP,NP)
19 complex(CK) :: rand_D0_CK, rand_D1_CK(NP), rand_D2_CK(NP,NP)
20 real(RK) :: rand_D0_RK, rand_D1_RK(NP), rand_D2_RK(NP,NP)
22 type(display_type) :: disp
28 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
29 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
30 call disp%show(
"! Generate `logical`-valued random numbers.")
31 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
32 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
36 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
37 call disp%show(
"! Generate a scalar logical random number.")
38 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
41 call disp%show(
"call setUnifRand(rand_D0_LK) ! random binary logical in the default range [.false._LK, .true._LK].")
48 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
49 call disp%show(
"! Generate a vector of logical random numbers.")
50 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
53 call disp%show(
"call setUnifRand(rand_D1_LK) ! random binary logical in the default range [.false._LK, .true._LK].")
60 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
61 call disp%show(
"! Generate a matrix of logical random numbers.")
62 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
65 call disp%show(
"call setUnifRand(rand_D2_LK) ! random binary integer in the default range [.false._LK, .true._LK].")
73 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
74 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
75 call disp%show(
"! Generate random `character` values.")
76 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
77 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
81 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
82 call disp%show(
"! Generate a scalar character random value.")
83 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
86 call disp%show(
"call setUnifRand(rand_D0_SK) ! random ASCII character in the default range [char(1), char(127)].")
89 call disp%show( rand_D0_SK , deliml
= SK_
"""" )
92 call disp%show(
"call setUnifRand(rand_D0_SK, lb = 'AA0aa', ub = 'ZZ9zz') ! random ASCII character in the range [""A"", ""z""].")
93 call setUnifRand(rand_D0_SK, lb
= 'AA0aa', ub
= 'ZZ9zz')
95 call disp%show( rand_D0_SK , deliml
= SK_
"""" )
99 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
100 call disp%show(
"! Generate a vector of character random values.")
101 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
104 call disp%show(
"call setUnifRand(rand_D1_SK) ! random ASCII character in the default range [char(1), char(127)].")
107 call disp%show( rand_D1_SK , deliml
= SK_
"""" )
110 call disp%show(
"call setUnifRand(rand_D1_SK, lb = 'Aa', ub = 'Zz') ! random ASCII character in the range [""Aa"", ""Zz""] for each character in string separately.")
113 call disp%show( rand_D1_SK , deliml
= SK_
"""" )
117 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
118 call disp%show(
"! Generate a matrix of character random values.")
119 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
122 call disp%show(
"call setUnifRand(rand_D2_SK) ! random ASCII character in the default range [char(1), char(127)].")
125 call disp%show( rand_D2_SK , deliml
= SK_
"""" )
128 call disp%show(
"call setUnifRand(rand_D2_SK, lb = 'aA', ub = 'zA') ! random ASCII character in the range [""aA"", ""zZ""] for each character in string separately.")
131 call disp%show( rand_D2_SK , deliml
= SK_
"""" )
136 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
137 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
138 call disp%show(
"! Generate `integer`-valued random numbers.")
139 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
140 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
144 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
145 call disp%show(
"! Generate a scalar integer random number.")
146 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
149 call disp%show(
"call setUnifRand(rand_D0_IK) ! random binary integer in the default range [0, 1].")
155 call disp%show(
"call setUnifRand(rand_D0_IK, -3_IK, 2_IK) ! random integer in range [-3 2].")
162 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
163 call disp%show(
"! Generate a vector of integer random numbers.")
164 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
167 call disp%show(
"call setUnifRand(rand_D1_IK) ! random binary integer in the default range [0, 1].")
173 call disp%show(
"call setUnifRand(rand_D1_IK, -3_IK, 2_IK) ! random integer in range [-3 2].")
180 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
181 call disp%show(
"! Generate a matrix of integer random numbers.")
182 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
185 call disp%show(
"call setUnifRand(rand_D2_IK) ! random binary integer in the default range [0, 1].")
191 call disp%show(
"call setUnifRand(rand_D2_IK, -3_IK, 2_IK) ! random integer in range [-3 2].")
199 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
200 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
201 call disp%show(
"! Generate `complex`-valued random numbers.")
202 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
203 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
207 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
208 call disp%show(
"! Generate a scalar complex random number.")
209 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
212 call disp%show(
"call setUnifRand(rand_D0_CK) ! random binary complex in the default range [(0,0), (1,1)].")
217 call disp%show(
"call setUnifRand(rand_D0_CK, (-3._CK, 3._CK), (2._CK, 5._CK))")
218 call setUnifRand(rand_D0_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK))
224 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
225 call disp%show(
"! Generate a vector of complex random numbers.")
226 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
229 call disp%show(
"call setUnifRand(rand_D1_CK) ! random binary complex in the default range [(0,0), (1,1)).")
234 call disp%show(
"call setUnifRand(rand_D1_CK, (-3._CK, 3._CK), (2._CK, 5._CK)).")
235 call setUnifRand(rand_D1_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK))
241 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
242 call disp%show(
"! Generate a matrix of complex random numbers.")
243 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
246 call disp%show(
"call setUnifRand(rand_D2_CK) ! random binary complex in the default range [(0,0), (1,1)).")
251 call disp%show(
"call setUnifRand(rand_D2_CK, (-3._CK, 3._CK), (2._CK, 5._CK)) ! random complex in range [(-3._CK, 3._CK), (2._CK, -2._CK)).")
252 call setUnifRand(rand_D2_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK))
259 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
260 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
261 call disp%show(
"! Generate `real`-valued random numbers.")
262 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
263 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
267 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
268 call disp%show(
"! Generate a scalar real random number.")
269 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
272 call disp%show(
"call setUnifRand(rand_D0_RK) ! random binary real in the default range [0, 1).")
278 call disp%show(
"call setUnifRand(rand_D0_RK, -3._RK, 2._RK) ! random real in range [-3 2).")
285 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
286 call disp%show(
"! Generate a vector of real random numbers.")
287 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
290 call disp%show(
"call setUnifRand(rand_D1_RK) ! random binary real in the default range [0, 1).")
296 call disp%show(
"call setUnifRand(rand_D1_RK, -3._RK, 2._RK) ! random real in range [-3 2).")
303 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
304 call disp%show(
"! Generate a matrix of real random numbers.")
305 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
308 call disp%show(
"call setUnifRand(rand_D2_RK) ! random binary real in the default range [0, 1).")
314 call disp%show(
"call setUnifRand(rand_D2_RK, -3._RK, 2._RK) ! random real in range [-3 2).")
325 integer :: rand(
5000)
327 if (
0 /= getErrTableWrite(SK_
"setUnifRand.IK.txt", rand))
error stop "Table writing failed."
331 complex :: rand(
5000)
333 if (
0 /= getErrTableWrite(SK_
"setUnifRand.CK.txt", rand))
error stop "Table writing failed."
339 if (
0 /= getErrTableWrite(SK_
"setUnifRand.RK.txt", rand))
error stop "Table writing failed."
Generate and return the iostat code resulting from writing the input table of rank 1 or 2 to the spec...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter CKS
The single-precision complex kind in Fortran mode. On most platforms, this is a 32-bit real kind.
integer, parameter CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
integer, parameter IKS
The single-precision integer kind in Fortran mode. On most platforms, this is a 32-bit integer kind.
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
55call setUnifRand(rand_D0_SK, lb
= 'AA0aa', ub
= 'ZZ9zz')
66"$5",
"er",
"␋r",
"&;",
"%+"
70"Oz",
"La",
"Rl",
"Lk",
"Ir"
79"[␛",
".N",
"n?",
"v␙",
"P␏"
80"Mo",
"[m",
"Hb",
"␟Z",
"@d"
81""#", " <", "␂1", "I]", "^O"
82"%␟",
"%>",
"J{",
"*/",
"dU"
83"LR",
"Fs",
"␇(",
"EO",
"Nj"
87"lA",
"fA",
"zA",
"aA",
"sA"
88"cA",
"bA",
"fA",
"eA",
"xA"
89"rA",
"vA",
"sA",
"vA",
"lA"
90"eA",
"oA",
"jA",
"cA",
"cA"
91"uA",
"tA",
"tA",
"qA",
"sA"
120+1575142597,
-450834387,
+669244938,
+1853608355,
-2127665488
133-1123179925,
+134504671,
-1867758580,
-56983882,
+974885794
134-1613024762,
+445423840,
-1949618644,
+1525795483,
+442514079
135-449650362,
+1778978784,
-659312373,
+1955684473,
-1575515134
136+2073713180,
+1513394460,
+457698142,
+1542036948,
-2072745761
137-307908104,
-1921074044,
+114511553,
+617531569,
-1476607733
161(
+0.525239944,
+0.487838268)
162call setUnifRand(rand_D0_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK))
164(
-2.66719484,
+4.65033865)
173(
+0.417975605,
+0.650212288), (
+0.109892666,
+0.575669169), (
+0.257214665,
+0.302728891), (
+0.132293820,
+0.180481911), (
+0.635234833,
+0.817474425)
174call setUnifRand(rand_D1_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK)).
176(
+0.880635202,
+4.04964113), (
+1.87991834,
+3.45902157), (
-2.96846485,
+3.38854694), (
+0.241707683,
+3.50855303), (
-0.140612245,
+4.87397814)
185(
+0.154150963,
+0.107938647E-1), (
+0.861932218,
+0.317988515), (
+0.351859152,
+0.664392531), (
+0.201444089,
+0.760473847), (
+0.874049723,
+0.797904849)
186(
+0.214663863,
+0.330731273), (
+0.848656535,
+0.850351453E-1), (
+0.974084020,
+0.587461710), (
+0.517491519,
+0.870555103), (
+0.374649704,
+0.686064482)
187(
+0.546197057,
+0.815288424), (
+0.338277638,
+0.748024404), (
+0.189188421,
+0.319404662), (
+0.322303355,
+0.488472581), (
+0.602265537,
+0.166299343)
188(
+0.425267875,
+0.163139164), (
+0.893530726,
+0.215405345), (
+0.941966295,
+0.673673749E-1), (
+0.271834671,
+0.140795350), (
+0.914202988,
+0.298280776)
189(
+0.701750755,
+0.879466772), (
+0.322951555,
+0.598841310), (
+0.957303822,
+0.759807885), (
+0.173094034,
+0.331221759), (
+0.422631264,
+0.167849779)
190call setUnifRand(rand_D2_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK))
192(
+0.758638203,
+3.14990425), (
+1.70777416,
+3.51842117), (
-1.59673572,
+4.36834049), (
+0.435485363,
+3.68693161), (
+1.09732914,
+3.92425156)
193(
-0.521290421,
+3.49146652), (
-1.29365528,
+3.78830242), (
-2.99138498,
+4.56841469), (
-0.826814055,
+4.79005098), (
+1.84468436,
+4.73858643)
194(
-1.38406634,
+3.91339493), (
-0.412080765,
+3.55408049), (
-0.596547961,
+4.63165188), (
-1.72978294,
+3.69970989), (
+0.858932853,
+3.70932508)
195(
+1.11270440,
+3.59204197), (
-0.522781253,
+3.99607372), (
+0.463968635,
+4.98884058), (
+1.30223048,
+3.87210655), (
-1.64944053,
+3.07271051)
196(
-1.07222545,
+3.90343952), (
-0.516059518,
+4.18118382), (
-1.61826015,
+3.14822578), (
-0.509538293,
+3.34560013), (
+1.73236501,
+3.32070923)
225+0.590782762E-1,
+0.879262149,
+0.390571356E-2,
+0.777250469,
+0.568826616
229+0.819801807,
-0.289891243,
-2.38394451,
+1.48984289,
+1.00179565
238+0.962382555,
+0.815497279,
+0.789634526,
+0.547535002,
+0.224926770
239+0.386942625E-1,
+0.229563117,
+0.610890031,
+0.565110683,
+0.562517107
240+0.185824037,
+0.821961224,
+0.691421330,
+0.287817121,
+0.139091969
241+0.902643383,
+0.830449283,
+0.316975594,
+0.848599255,
+0.379116118
242+0.290326834,
+0.898208857,
+0.977422595,
+0.127535641,
+0.513128161
246-1.64051270,
+1.58160996,
-1.10747266,
+1.17239428,
-1.70654142
247-0.688870788,
-0.656294942,
-2.11774945,
+0.634704649,
+0.576334417
248+1.65606952,
-0.390764952,
-1.86045301,
+1.37227905,
+0.856558084E-1
249-2.27072096,
-0.850019574,
-2.06927657,
-2.51169848,
-0.788066506
250+0.255499244,
-1.27872634,
-0.755657792,
+0.827765584,
-0.116707563
Postprocessing of the example output ⛓
3import matplotlib.pyplot
as plt
16xlab = {
"CK" :
"Uniform Random Value ( real/imaginary components )"
17 ,
"IK" :
"Uniform Random Value ( integer-valued )"
18 ,
"RK" :
"Uniform Random Value ( real-valued )"
25for kind
in [
"IK",
"CK",
"RK"]:
27 pattern =
"*." + kind +
".txt"
28 fileList = glob.glob(pattern)
29 if len(fileList) == 1:
31 df = pd.read_csv(fileList[0], delimiter =
",", header =
None)
33 fig = plt.figure(figsize = 1.25 * np.array([6.4, 4.8]), dpi = 200)
36 for j
in range(len(df.values[0,:])):
38 plt.hist( df.values[:,j]
39 , histtype =
"stepfilled"
44 plt.hist( df.values[:,j]
45 , histtype =
"stepfilled"
52 plt.xticks(fontsize = fontsize - 2)
53 plt.yticks(fontsize = fontsize - 2)
54 ax.set_xlabel(xlab[kind], fontsize = 17)
55 ax.set_ylabel(
"Count", fontsize = 17)
56 ax.set_title(
"Histograms of {} Uniform random values".format(len(df.values[:, 0])), fontsize = 17)
58 plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
59 ax.tick_params(axis =
"y", which =
"minor")
60 ax.tick_params(axis =
"x", which =
"minor")
62 plt.savefig(fileList[0].replace(
".txt",
".png"))
64 elif len(fileList) > 1:
66 sys.exit(
"Ambiguous file list exists.")
Visualization of the example output ⛓
- Test:
- test_pm_distUnif
- Bug:
Status: Unresolved
Source: GNU Fortran Compiler gfortran
version 10.3
Description: GNU Fortran Compiler gfortran
yields an internal compiler error with the expression rand = nint(temp, kind = IKG)
in pm_distUnif@routines[IK](@ref pm_kind::IK).inc.F90
file when IKG => integer_kinds(5)
on WSL OS.
Remedy (as of ParaMonte Library version 2.0.0): For now, the expression is replaced with rand = int(0.5d0 + temp, kind = IKG)
.
- Bug:
Status: Unresolved
Source: Intel LLVM Fortran Compiler ifx
version 2025.0.0 20241008
Description: Intel LLVM Fortran Compiler ifx
version 2025.0.0 20241008 cannot compile the following two lines of code in the include file pm_distUnif@routines.inc.F90
.
Note that ifort
can readily compile the above lines of code.
Uncomment the above two lines to regenerate the compile-time error.
Remedy (as of ParaMonte Library version 2.0.0): For now, these two lines are commented out for Intel compilers and replaced with the following.
call setUnifRand(RNG rand
%re,
real(lb, CKG),
real(ub, CKG))
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.
-
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.
-
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.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, Oct 16, 2009, 11:14 AM, Michigan
Definition at line 11083 of file pm_distUnif.F90.