Manual Reference Pages - mtprng_rand (3m_random)
NAME
mtprng_rand(3f) - [M_random:MERSENNE TWISTER] Obtain the next 32-bit integer in the pseudo-random sequence
(LICENSE:CUSTOM OPEN)
CONTENTS
Synopsis
Description
Options
Returns
Example
SYNOPSIS
function mtprng_rand(state) result(r)
type(mtprng_state), intent(inout) :: state
integer(INT32) :: r
DESCRIPTION
Obtain the next 32-bit integer in the pseudo-random sequence
OPTIONS
state |
generator state initialized by mtprng_init(3f) or mtprng_init_array(3f)
|
|
RETURNS
r |
The next 32-bit integer in the pseudo-random sequence
|
|
EXAMPLE
Sample program:
program demo_mtprng_rand
use M_random, only : mtprng_state, mtprng_init, mtprng_rand
use, intrinsic :: iso_fortran_env, only : int32
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)
! returns a INT32 integer with a range in 0 .. 2^31-1
write(*,*) mtprng_rand(state)
end program demo_mtprng_rand
Nemo Release 3.1 | mtprng_rand (3m_random) | April 12, 2023 |
Generated by manServer 1.08 from 4dc4bd63-dba7-44e2-9634-5fa901a8afb3 using man macros.