da1a9239f1b5da56de142c99ad131979fb22c166
* harbour/src/rtl/hbrandom.c
! fixed HB_RANDOMINTMAX() to return correct value for new PRNG
used by HB_RANDOM() and HB_RANDOMINT() functions
! fixed missing protection against initialization of PRNG seed with 0
* modified the range of hb_random_num() results from ( 0 , 1 ) to
[ 0, 1 )
% added alternative PRN calculation for builds with 64bit integers
! allocate separate PRNG seed for each thread (MT support)
* modified default initialization of PRNG:
if PRNG is not initialized or after HB_RANDOMSEED( 0 ) then
first call to HB_RANDOM() or HB_RANDOMINT() activates
initialization which generates new seed using current time
in milliseconds and HVM stack address (for MT modes).
I used such method because it nicely simplifies code and is
backward compatible with previous implementation.
If someone needs repeatable results from HB_RANDOM() and
HB_RANDOMINT() then he should initialize PRNG seed for each
thread with some fixed value i.e.:
HB_RANDOMSEED( 123456789 )
; Many thanks to Viktor and Mindaugas for their help.
* harbour/contrib/xhb/xhbole.prg
! added missing SETGET in method declaration.
Many thanks to Juan Galvez for locating the problem.
Description
Harbour Core — Reference source for Five development
Languages
C
80.3%
xBase
17.8%
Makefile
0.6%
C++
0.4%
Harbour
0.4%
Other
0.3%