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(kind=i4), | 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=i4), | public | :: | kmin | ||||
| integer(kind=i4), | 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], int32
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| integer(kind=i4), | intent(in) | :: | i1 | |||
| integer(kind=i4), | intent(in) | :: | i2 |
Generates a random integer number in the range [i1, i2], int32
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| integer(kind=i4), | intent(in) | :: | i1 | |||
| integer(kind=i4), | intent(in) | :: | i2 |
Generates a random integer number in the range [i1, i2], int64
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| integer(kind=i8), | intent(in) | :: | i1 | |||
| integer(kind=i8), | intent(in) | :: | i2 |
Generates a random real number in the range [r1, r2), double
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| real(kind=dp), | intent(in) | :: | r1 | |||
| real(kind=dp), | intent(in) | :: | r2 |
Generates a random real number in the range [r1, r2), single
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| real(kind=sp), | intent(in) | :: | r1 | |||
| real(kind=sp), | intent(in) | :: | r2 |
Initializes the random number generator
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| integer(kind=i4) | :: | 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 |
Save the current seeds to a seeds object and, optionally, to a file name
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| type(rndSeed), | intent(out) | :: | u_mseed | |||
| character(len=*), | intent(in) | :: | filename |
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 |
Read the seeds from a seeds object or, optionally, from a file name
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen) | :: | this | ||||
| type(rndSeed), | intent(in) | :: | u_mseed | |||
| character(len=*), | intent(in) | :: | filename |
Generates a random array of real numbers in the range [0, 1)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen), | intent(in) | :: | gen | |||
| integer(kind=i4), | intent(in) | :: | n |
Generates a random array of real numbers in the range [r1, r2)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen), | intent(in) | :: | gen | |||
| integer(kind=i4), | intent(in) | :: | n | |||
| real(kind=dp), | intent(in) | :: | r1 | |||
| real(kind=dp), | intent(in) | :: | r2 |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen), | intent(in) | :: | gen | |||
| integer(kind=i4), | intent(in) | :: | n | |||
| integer(kind=i4), | intent(in) | :: | i1 | |||
| integer(kind=i4), | intent(in) | :: | i2 |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen), | intent(in) | :: | gen | |||
| integer(kind=i4), | intent(in) | :: | n | |||
| integer(kind=i4), | intent(in) | :: | i1 | |||
| integer(kind=i4), | intent(in) | :: | i2 |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgen), | intent(in) | :: | gen | |||
| integer(kind=i4), | intent(in) | :: | n | |||
| integer(kind=i8), | intent(in) | :: | i1 | |||
| integer(kind=i8), | intent(in) | :: | i2 |
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=i4), | intent(in) | :: | kmin | |||
| integer(kind=i4), | intent(in) | :: | kmax | |||
| real(kind=dp), | intent(in) | :: | gama | |||
| integer, | intent(in), | optional | :: | iseed |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rndgenPL), | intent(in) | :: | gen | |||
| integer(kind=i4), | intent(in) | :: | n |