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
This commit is contained in:
Viktor Szakats
2011-05-17 17:03:32 +00:00
parent 9815b01434
commit 14d0d4161d
3 changed files with 14 additions and 0 deletions

View File

@@ -16,6 +16,14 @@
The license applies to all entries newer than 2009-04-28.
*/
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
2011-05-17 17:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
! escape fn passed to upx

View File

@@ -691,6 +691,7 @@ DYNAMIC HB_PROCESSVALUE
DYNAMIC HB_PROGNAME
DYNAMIC HB_PS
DYNAMIC HB_PVALUE
DYNAMIC HB_RAND32
DYNAMIC HB_RANDOM
DYNAMIC HB_RANDOMINT
DYNAMIC HB_RANDOMSEED

View File

@@ -118,6 +118,11 @@ HB_FUNC( HB_RANDOMINT )
}
}
HB_FUNC( HB_RAND32 ) /* returns an integer between 0 and 0xFFFFFFFF (inclusive) */
{
hb_retnint( ( HB_MAXINT ) ( hb_random_num() * ( HB_MAXINT ) HB_U32_MAX ) );
}
HB_FUNC( HB_RANDOMSEED )
{
srand( HB_ISNUM( 1 ) ? ( unsigned ) hb_parni( 1 ) : ( unsigned ) hb_dateMilliSeconds() );