![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
sci.crypt archiveRe: 63/64 bit version of Delphi's function random( aRange : integer ) : integer; ?
From: Skybuck Flying <spam@hotmail.com>
Date: Fri Apr 28 2006 - 06:16:43 CEST
"Mike Warren" <miwa-not-this-bit@or-this-csas.net.au> wrote in message
Where does the parameter go in ?
It's missing ?
Variable I is supposed to be in the range 0 to Parameter-1
Nice idea though...
But it needs quite a lot of modification/work:
First the parameter has to be split up into two 32 bit words/integers.
Then the words can be randomized.
Then the result has to be put back into 64 bits...
I := Random( first 32 bits of parameter)
Finally I don't feel confident and the correctness of the code.
It will probably leave some offsets unused ?
On top of that... many possibilities for coding errors/troubles...
Shift errors, range check errors, signed problems, unsigned problems...
Just to be able to use 64 bits.
Bad but interesting.
I will leave it at that.
It will probably not be possible to compare the output of this version with
So another testing method will have to be used to check if all offsets are
Or one has to go about it in theory... to much work if you ask me ;)
I choose the path of reverse enginering and going with a modified 64 bit
I think that will be faster and less error prone.
Only one instruction to go.
I wonder how the assembler applies the range limit, haven't understood that
Finally calling random twice and all these extra instructions is pushing my
Bye,
|