diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ae89f0883d..2f7bf45e5e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2011-03-11 09:42 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/hbrandom.c + ! fixed double number calculation for random values by removing + some wrong trick with epsilon value. rand() function returns + numbers in range [0,RAND_MAX] (inclusive) so can give RAND_MAX+1 + different results and this is the correct divisor to map rand() + results to real range [0,1) ( 0 <= n < 1 ) + 2011-03-10 19:13 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/hbqt_init.cpp ! Fixed: one remaining warning - arguments. diff --git a/harbour/src/rtl/hbrandom.c b/harbour/src/rtl/hbrandom.c index 69f38572c1..959e1961c2 100644 --- a/harbour/src/rtl/hbrandom.c +++ b/harbour/src/rtl/hbrandom.c @@ -136,16 +136,7 @@ double hb_random_num() } d1 = ( double ) rand(); - d2 = ( double ) RAND_MAX; -#if defined( __BORLANDC__ ) - /* It seems that on Windows platform there some weirdness about EPSILON value so - that a float division using an epsilon smaller than 1e-10 may be rounded. - Must dig if it's a borland lib bug or a windows problem. - */ - d2 += 0.001; -#else - d2 += DBL_EPSILON; -#endif + d2 = ( double ) RAND_MAX + 1.0; return d1 / d2; }