Logo

Programming-Idioms

History of Idiom 15 > diff from v48 to v49

Edit summary for version 49 by OC:
New Obj-C implementation by user [OC]

Version 48

2020-09-28, 19:39:34

Version 49

2020-10-11, 00:02:20

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.

Variables
a,b
Variables
a,b
Extra Keywords
choose
Extra Keywords
choose
Code
a+arc4random_uniform(b+1)
Comments bubble
Actually same as plain C, if the API is available