SERVER-470 improve JS rand()

This commit is contained in:
Aaron
2010-01-04 17:28:42 -08:00
parent 35d800321b
commit e2bac039d1
2 changed files with 2 additions and 2 deletions

View File

@@ -494,7 +494,7 @@ namespace mongo {
BSONObj JSRand( const BSONObj &a ) {
uassert( 12519, "rand accepts no arguments", a.nFields() == 0 );
return BSON( "" << double( rand_r( &_randomSeed ) ) / RAND_MAX );
return BSON( "" << double( rand_r( &_randomSeed ) ) / ( double( RAND_MAX ) + 1 ) );
}
void installShellUtils( Scope& scope ){