Random number generator object for power-law distribution, adapted from Silvio C. Ferreira code. The power-law distribution is given by P(k) = k^(-gamma), where k is an integer between kmin and kmax.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | o_iseed | ||||
type(rndSeed), | public | :: | seed | ||||
real(kind=dp), | private | :: | AA | ||||
real(kind=dp), | private | :: | expo | ||||
real(kind=dp), | private | :: | x0 | ||||
real(kind=dp), | private | :: | xc | ||||
real(kind=dp), | public | :: | gamma | ||||
integer(kind=i16), | public | :: | kmin | ||||
integer(kind=i16), | public | :: | kmax | ||||
real(kind=dp), | private, | allocatable | :: | prob(:) |
Generates a random number in the range [0, 1)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgen) | :: | this |
Generates a random integer number in the range [i1, i2]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgen) | :: | this | ||||
integer(kind=i16), | intent(in) | :: | i1 | |||
integer(kind=i16), | intent(in) | :: | i2 |
Generates a random real number in the range [r1, r2)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgen) | :: | this | ||||
real(kind=dp), | intent(in) | :: | r1 | |||
real(kind=dp), | intent(in) | :: | r2 |
Initializes the random number generator
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgen) | :: | this | ||||
integer(kind=i8) | :: | iseed |
Resets the random number generator
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgen) | :: | this |
Save the current seeds to a seeds object and, optionally, to a file unit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgen) | :: | this | ||||
type(rndSeed), | intent(out) | :: | u_mseed | |||
integer, | intent(in), | optional | :: | und |
Read the seeds from a seeds object or, optionally, from a file unit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgen) | :: | this | ||||
type(rndSeed), | intent(in) | :: | u_mseed | |||
integer, | intent(in), | optional | :: | und |
Generates a random number following the power-law distribution
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgenPL) | :: | this |
Initializes the power-law random number generator
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rndgenPL) | :: | this | ||||
integer(kind=i16), | intent(in) | :: | kmin | |||
integer(kind=i16), | intent(in) | :: | kmax | |||
real(kind=dp), | intent(in) | :: | gama | |||
integer, | intent(in), | optional | :: | iseed |