id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	lang	patch	platform
392	Make rand/srand work the same for 32bit and 64bit int	rg		"Currently, the t/library/rand.t test is failing on 64bit platforms, because the new library rand is relying on overflowing with 32bits. See for example [http://smolder.plusthree.com/app/public_projects/report_details/18487#first_failure this report] or the general amd64 smolder listing (sorry can't link).

The attached patch makes the rand function behave the same on 32bit and 64bit platforms.

Disclaimer: I'm not expert on those functions and it could be possible that the 32bit overflow is actually required for a nice distribution.

As an alternative, FreeBSD is using [http://www.gnu.org/software/gsl/manual/html_node/Other-random-number-generators.html#index-gsl_005frng_005fminstd-1550 this algorithm (gsl_rng_minstd)], which can be calculated without overflowing 31 bits. However, it also has a RAND_MAX of 2^31^ and I don't know if any parrot code relies on rand only having RAND_MAX of 2^15^. Still, if you don't like the patch, I'm offering to implement that algorithm.
"	bug	closed	normal		library	trunk	medium	fixed	rand srand Math Rand.pir			applied	all
