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"␛%",
"␃d",
"{␌",
"C@",
"kJ"
70"Oy",
"Ob",
"Uh",
"Rq",
"Do"
809",
"RU",
"␗D",
"*",
"q|"
81":M",
"i*",
"␚'",
"<p",
"␜␔"
82"␆/",
";␐",
"9m",
"}␛",
"}}"
83"a␇",
"Vi",
"_␆",
"e7",
"␗%"
84"$E",
""␛
", "{
>", "#@", "g7"
88"jA",
"yA",
"qA",
"tA",
"jA"
89"zA",
"tA",
"sA",
"hA",
"wA"
90"fA",
"yA",
"yA",
"jA",
"nA"
91"hA",
"sA",
"rA",
"mA",
"nA"
92"tA",
"aA",
"xA",
"fA",
"tA"
121+911067877,
+580253247,
-1909834740,
+1335013705,
+29763099
134-1079679412,
-59601019,
-625958692,
-793727220,
+1330315409
135+333711401,
+572598291,
-1965149994,
-1999105452,
+2116805661
136+166272347,
-361791108,
+313801283,
-1973119100,
-1141826094
137-745268411,
-1721836505,
+1719886329,
-997720508,
+287898742
138-1122728264,
-661545981,
-396392651,
+2002469396,
+1007108166
162(
+0.482312024,
+0.422418535)
163call setUnifRand(rand_D0_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK))
165(
+1.06354070,
+4.68714571)
174(
+0.994532704E-1,
+0.780992627), (
+0.591673851,
+0.539248407), (
+0.656540930,
+0.655153513), (
+0.264971554,
+0.514710903), (
+0.282100260,
+0.351772010)
175call setUnifRand(rand_D1_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK)).
177(
-0.298624873,
+3.46737146), (
-2.94901299,
+3.99629068), (
+1.71317947,
+4.10896778), (
+1.71079254,
+4.82379103), (
-0.115513682,
+4.47945404)
186(
+0.512839913,
+0.746633172), (
+0.378074169,
+0.477648318), (
+0.597242892,
+0.518050671), (
+0.970105052,
+0.410534203), (
+0.628298759,
+0.561877191)
187(
+0.999160171,
+0.299518287), (
+0.184468269,
+0.735189140), (
+0.931638360,
+0.969165802), (
+0.783276021,
+0.398124516), (
+0.629791796,
+0.602908671)
188(
+0.467123568,
+0.444758058), (
+0.234700561,
+0.238329768), (
+0.160237074,
+0.750348508), (
+0.638902307,
+0.980197966), (
+0.764425397,
+0.412401974)
189(
+0.599646986,
+0.872758090), (
+0.501032352,
+0.786383331), (
+0.383591354,
+0.970865905), (
+0.190041125,
+0.203448772), (
+0.515372753,
+0.938299775)
190(
+0.423564374,
+0.342086256), (
+0.378184140,
+0.850599825), (
+0.584431827,
+0.821191728), (
+0.279428124,
+0.604142308), (
+0.579030454,
+0.798562169)
191call setUnifRand(rand_D2_CK, (
-3._CK,
3._CK), (
2._CK,
5._CK))
193(
-1.73714089,
+3.67098761), (
-0.799981833,
+4.35614395), (
-0.192996144,
+4.50153542), (
+1.98153543,
+4.93074465), (
+0.891915977,
+3.34377766)
194(
+0.125078082,
+4.55194283), (
-1.11124921,
+3.92637634), (
+1.56113756,
+4.51977539), (
-1.07489789,
+3.50250912), (
-0.526072860,
+3.07821369)
195(
+0.845455050,
+4.96920776), (
-2.55553198,
+4.72601318), (
-2.98965693,
+4.95120668), (
+1.24411798,
+3.07769775), (
-0.243084550,
+4.07232952)
196(
+1.75754166,
+3.54302168), (
+0.374806345,
+3.45829582), (
+0.470424414,
+4.26510286), (
-2.71038342,
+4.52484512), (
-1.84219968,
+4.63151312)
197(
-0.601720929,
+3.51646996), (
-2.36046052,
+3.08516598), (
-1.83439696,
+4.13560534), (
-0.334648728,
+4.94140530), (
-1.38124907,
+3.90135336)
226+0.399635851,
+0.890500903,
+0.193489313,
+0.761683702,
+0.535666406
230-2.54502344,
+0.219650269E-1,
-0.177106500,
+1.93277049,
-1.22350585
239+0.284526944,
+0.640240133,
+0.474784672,
+0.108080029,
+0.634101927
240+0.956812561,
+0.151904881,
+0.657458782,
+0.794737995,
+0.123033524
241+0.559922934,
+0.473950386,
+0.641952336,
+0.173796892,
+0.453525722
242+0.963096619E-1,
+0.279673040,
+0.819945812,
+0.335384250,
+0.159310997
243+0.491349041,
+0.764832199,
+0.796371520,
+0.461930573,
+0.282427609
247+0.289880157,
+1.45865870,
-1.83928216,
-2.66684890,
-2.93343067
248+0.422971666,
-1.12360799,
+0.558495343,
+0.471411169,
+1.23507714
249-1.81667531,
-0.584695458,
+0.744783401,
-0.372542262,
-0.394539475
250-0.671780229,
-2.83652759,
+1.78182054,
+0.526969850,
+1.42886293
251-2.14307761,
-2.74374151,
-0.475004554,
-0.545832753,
-2.08736777
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.