sample a random integer between [a, b]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | a |
lower bound |
||
integer, | intent(in) | :: | b |
higher bound |
integer function randint(a, b) !! sample a random integer between [a, b] !> lower bound integer, intent(IN) :: a !> higher bound integer, intent(IN) :: b randint = a + floor((b + 1 - a)*ran2()) end function randint