﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
218	random not random	Jim Ursetto		"So rand() is completely subpar at generating random numbers in two ways:

1. Lower bits are not random.  We already work around this in the standard manner by scaling the result of a floating-point division.

2. Nearby seeds don't affect the output much.

Due to # 2, on Mac OS X we may obtain the same initial random number for a minute or more, even though it is seeded with (current-seconds):
{{{
while :; do csi -p '(random 1000)'; sleep 5; done
734
734
734
734
734
209
209
}}}

We can fix the problem on OS X by using random(3) instead of rand(3), which is present on all BSDs and on Linux.

Internally, Linux uses random() when rand() is called and some BSDs seem to as well.  However, there should be no harm anyway in applying the attached patch, which affects linux and bsd."	defect	closed	minor		core libraries		worksforme			
