Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include	<u.h>
2
#include	<libc.h>
3
 
4
#define	MASK	0x7fffffffL
5
#define	NORM	(1.0/(1.0+MASK))
6
 
7
double
8
frand(void)
9
{
10
	double x;
11
 
12
	do {
13
		x = lrand() * NORM;
14
		x = (x + lrand()) * NORM;
15
	} while(x >= 1);
16
	return x;
17
}