main class for random number generator
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=i8), | public | :: | mt(nn) | = | 0_i8 | array for the state vector |
|
integer, | public | :: | mti | = | nn+1 |
|
call first to initialize
Initializes me%mt(nn)
with a seed
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me | |||
integer(kind=i4), | intent(in) | :: | seed |
Initializes me%mt(nn)
with a seed
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me | |||
integer(kind=i8), | intent(in) | :: | seed |
Initializes by an array with array-length
init_key
is the array for initializing keys
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me | |||
integer(kind=i8), | intent(in) | :: | init_key(:) |
Initializes me%mt(nn)
with a seed
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me | |||
integer(kind=i8), | intent(in) | :: | seed |
Initializes by an array with array-length
init_key
is the array for initializing keys
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me | |||
integer(kind=i8), | intent(in) | :: | init_key(:) |
Initializes me%mt(nn)
with a seed
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me | |||
integer(kind=i4), | intent(in) | :: | seed |
Generates a random number on [0,1]-real-interval
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me |
Generates a random number on [0,1)-real-interval
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me |
Generates a random number on (0,1)-real-interval
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me |
Generates a random number on [-2^63, 2^63-1]-interval
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mt19937), | intent(inout) | :: | me |
type,public :: mt19937
!! main class for random number generator
private
integer(i8) :: mt(nn) = 0_i8 !! array for the state vector
integer :: mti = nn+1 !! `mti==nn+1` means `mt(nn)` is not initialized
contains
private
generic,public :: initialize => init_genrand64_i4, &
init_genrand64, &
init_by_array64 !! call first to initialize
procedure :: init_genrand64
procedure :: init_by_array64
procedure :: init_genrand64_i4
procedure, public :: genrand64_real1
procedure, public :: genrand64_real2
procedure, public :: genrand64_real3
procedure, public :: genrand64_int64
end type mt19937