Board index » delphi » Re: AMRandom v4.0

Re: AMRandom v4.0


2005-10-24 10:08:38 AM
delphi24
awesome !
--
JoeH
[ write a letter, save a life - www.amnesty.org ]
 
 

Re: AMRandom v4.0

What would be the advantage of using thi instead of Delphi's Random?
 

Re: AMRandom v4.0

"John" <XXXX@XXXXX.COM>writes
Quote
What would be the advantage of using thi instead of Delphi's Random?
AMrandom contains 2 parts:
1) A random number generator known as MRNG, which is better than Delphi's
own (better statistical spread, longer cycles etc.)
2) The main content are functions for transforming those uniform [0;1[
random numbers into random number according to various statistical
distributions.
Regards
Uffe
 

Re: AMRandom v4.0

"Glenn Crouch" <XXXX@XXXXX.COM>wrote
Quote
www.esbconsult.com - grab it from the downloads directory :)
Nice :) I am just curious, though. Why are these extra functions defined?
function DelphiRandom: Extended;
begin
Result := Random;
end;
{$IFDEF UseMRNG}
function MRNGRandom: Extended;
begin
Result := MRandom;
end;
{$ENDIF}
Wouldn't it be more efficient to pass by ref the random value to the shaper
functions instead of function pointers, ie instead of
function Random_Gamma (const Shape: Extended;
RandomGenerator: TRandomGenFunction): Extended; overload;
// call by Random_Gamma(3,MRNGRandom) / Random_Gamma(3,DelphiRandom)
to have
function Random_Gamma (const Shape: Extended;
const Random: Extended): Extended; overload;
// call by Random_Gamma(3,MRandom) / Random_Gamma(3,Random)
which avoids the extra function call and is more extensible? Of course I
could be wrong but I thought Delphi didn't remove float identity functions
in the code generator, or am I missing something else obvious?
 

Re: AMRandom v4.0

Quote
1) A random number generator known as MRNG, which is better than
Delphi's
own (better statistical spread, longer cycles etc.)
Please note this is not ours but was developed by EFD - their website no
longer appears to be functioning and so we've included this free file
for the convenience of AMRandom users :)
Glenn Crouch mailto:XXXX@XXXXX.COM
ESB Consultancy www.esbconsult.com
Home of ESBPCS & ESB Calculators
Kalgoorlie-Boulder, Western Australia
 

Re: AMRandom v4.0

Quote
Wouldn't it be more efficient to pass by ref the random value to the
shaper
functions instead of function pointers, ie instead of
My original intention when I did the port many years ago was to allow
quite complex functions to be inserted for the Uniform Random Number
Generator - but your approach is probably better - though I wouldn't
want to break existing code given the number of years that this library
has been around :)
I suppose I could add an extra overloaded version that handles things
the way you suggest :)
Glenn Crouch mailto:XXXX@XXXXX.COM
ESB Consultancy www.esbconsult.com
Home of ESBPCS & ESB Calculators
Kalgoorlie-Boulder, Western Australia