Manual Reference Pages - mtprng_rand64 (3)
NAME
mtprng_rand64(3f) - [M_random:MERSENNE TWISTER] Obtain the next 64-bit integer in the pseudo-random sequence
(LICENSE:CUSTOM OPEN)
CONTENTS
Synopsis
Description
Options
Returns
Example
SYNOPSIS
function mtprng_rand64(state) result(r)
type(mtprng_state), intent(inout) :: state
integer(INT64) :: r
DESCRIPTION
Obtain the next 64-bit integer in the pseudo-random sequence in the range 0 to 2^32-1.
Note that the range is considerably below the value of HUGE(0_int64).
OPTIONS
state |
generator state initialized by mtprng_init(3f) or mtprng_init_array(3f)
|
|
RETURNS
r |
next pseudo-random value in the range 0 to 2^32-1
|
|
EXAMPLE
Sample program:
program demo_mtprng_rand64
use M_random, only : mtprng_state, mtprng_init, mtprng_rand64
use, intrinsic :: iso_fortran_env, only : int32, int64
implicit none
integer(INT32) :: seed
type(mtprng_state) :: state
GET_SEED: block
integer :: count
integer :: count_rate
call system_clock(count, count_rate)
seed = count
endblock GET_SEED
call mtprng_init(seed, state)
write(*,*) mtprng_rand64(state)
end program demo_mtprng_rand64
| mtprng_rand64 (3) | October 17, 2020 |
Generated by manServer 1.08 from 7ea6f910-1e54-49de-bd5c-57a14be1a99c using man macros.