2011-05-17 19:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/hbrandom.c
! fixed wrong random numbers being generated after:
2011-03-11 09:42 UTC+0100 Przemyslaw Czerpak
this is simple revert, Przemek pls recheck/refix original issue.
Values 0x????FFFF and 0x????0000 were returned from these calls:
hb_randomInt( 0xFFFFFFFF )
hb_randomInt( 0xFFFFFFFE )
hb_randomInt( 0x7FFFFFFF )
under mingw32 and mingw64 (both win and linux builds)
This commit is contained in:
@@ -16,13 +16,24 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-05-17 19:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/rtl/hbrandom.c
|
||||
! fixed wrong random numbers being generated after:
|
||||
2011-03-11 09:42 UTC+0100 Przemyslaw Czerpak
|
||||
this is simple revert, Przemek pls recheck/refix original issue.
|
||||
Values 0x????FFFF and 0x????0000 were returned from these calls:
|
||||
hb_randomInt( 0xFFFFFFFF )
|
||||
hb_randomInt( 0xFFFFFFFE )
|
||||
hb_randomInt( 0x7FFFFFFF )
|
||||
under mingw32 and mingw64 (both win and linux builds)
|
||||
|
||||
2011-05-17 19:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* include/harbour.hbx
|
||||
* src/rtl/hbrandom.c
|
||||
+ HB_RAND32() -> <32-bit random number>
|
||||
|
||||
; TOFIX: random numbers are broken under mingw 4.5.2, only high 16bits are random.
|
||||
in all HB_RAND*() functions
|
||||
in all HB_RAND*() functions [DONE]
|
||||
|
||||
2011-05-17 17:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* utils/hbmk2/hbmk2.prg
|
||||
|
||||
@@ -141,7 +141,20 @@ double hb_random_num()
|
||||
}
|
||||
|
||||
d1 = ( double ) rand();
|
||||
#ifdef __HB_THIS_FIX_BREAKS_MINGW32_64__
|
||||
d2 = ( double ) RAND_MAX + 1.0;
|
||||
#else
|
||||
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
|
||||
#endif
|
||||
|
||||
return d1 / d2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user