Board index » delphi » Re: AMRandom v4.0
Joe Hendricks
Delphi Developer |
Joe Hendricks
Delphi Developer |
Re: AMRandom v4.0 |
John
Delphi Developer |
2005-10-24 03:12:26 PM
Re: AMRandom v4.0
What would be the advantage of using thi instead of Delphi's Random?
|
Uffe Kousgaard
Delphi Developer |
2005-10-24 03:54:11 PM
Re: AMRandom v4.0
"John" <XXXX@XXXXX.COM>writes
QuoteWhat would be the advantage of using thi instead of Delphi's Random? 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 |
somebody
Delphi Developer |
2005-10-24 04:23:11 PM
Re: AMRandom v4.0
"Glenn Crouch" <XXXX@XXXXX.COM>wrote
Quotewww.esbconsult.com - grab it from the downloads directory :) 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? |
Glenn Crouch
Delphi Developer |
2005-10-24 04:51:46 PM
Re: AMRandom v4.0Quote1) A random number generator known as MRNG, which is better than 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 |
Glenn Crouch
Delphi Developer |
2005-10-24 08:40:02 PM
Re: AMRandom v4.0QuoteWouldn't it be more efficient to pass by ref the random value to the 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 |