Fix nonuniform distribution of mono_rand_try_get_uint32
commit68209ec30fd3abe0e73b2c8f7dd8e562a5b0d069
authorAndi McClure <andi.mcclure@xamarin.com>
Fri, 15 Jan 2016 16:19:35 +0000 (15 11:19 -0500)
committerAndi McClure <andi.mcclure@xamarin.com>
Fri, 15 Jan 2016 16:19:35 +0000 (15 11:19 -0500)
treee8a9e30902b65be85164917ccf91491d4559a65e
parent88ccc1436136ddc7dc07cf460c632010b7a62440
Fix nonuniform distribution of mono_rand_try_get_uint32

mono_rand_try_get_uint32 returns a value in a range min..max
inclusive. Due to a math error the ‘max’ value will be returned only
one out of every 2^32-1 calls to the function. This is currently
harmless because the only current callers of this function (in
threadpool-ms-io) will run fine even if their max value is never
returned, but it could become a problem later.
mono/utils/mono-rand.c