Logo

Programming-Idioms

History of Idiom 15 > diff from v40 to v41

Edit summary for version 41 by tkoenig:
New Fortran implementation by user [tkoenig]

Version 40

2019-09-26, 17:12:46

Version 41

2019-09-26, 20:34:09

Idiom #15 Pick uniformly a random integer in [a..b]

Pick a random integer greater than or equals to a, inferior or equals to b. Precondition : a < b.

Idiom #15 Pick uniformly a random integer in [a..b]

Pick a random integer greater than or equals to a, inferior or equals to b. Precondition : a < b.

Extra Keywords
choose
Extra Keywords
choose
Code
real :: c
integer :: res

call random_number(c)
res = int((b-a+1)*c)