Below I pasted an assembly source of a random number generator that uses
an
algorithm based on multiplication with a prime number and XOR-ing with a
fixed mask.
In its current form, it produces numbers in the range 0..27, but you can
easily change that. You have to know that the
] At 21:06 26-8-00 +0200, you wrote:
] Albert Beevendorp wrote:
] ld a,r
] ld b,a
] ld a,r
] xor b
] ld b,a
] ld a,r
] xor b
]
] is a better way to randomize and repeating this more should improve it.
] I don't think so, because the time it takes to repeat it is constant so R
]
; Fast random number generator using the same method
; as the CDMA used in celullar telephones
SEED: DW 0
; init random seed
INIT_SEED:
I've been working on a game for some time now (Bomberman, MAYBE FutureDisk
will show a demo of it on the Bussum-fair) but I'm having some troubles with
generating random numbers. I'm now using the refresh register which I add to
the previous offset in a look-up table, but it isn't random enough
On Sat, 26 Aug 2000, you wrote:
I've been working on a game for some time now (Bomberman, MAYBE FutureDisk
will show a demo of it on the Bussum-fair) but I'm having some troubles
with generating random numbers. I'm now using the refresh register which I
add to the previous offset in a look-up
Arjan Bakker wrote:
I'm having some troubles with
generating random numbers. I'm now using the refresh register which I add to
the previous offset in a look-up table, but it isn't random enough for me.
In stead of adding 'R' to the previous offset, try adding the joystick
inputs. Or rotate
At 19:46 26-8-00 +0200, you wrote:
I've been working on a game for some time now (Bomberman, MAYBE FutureDisk
will show a demo of it on the Bussum-fair) but I'm having some troubles with
generating random numbers. I'm now using the refresh register which I add to
the previous offset in a look-up
At 20:24 26-8-00 +0200, you wrote:
At 19:46 26-8-00 +0200, you wrote:
I've been working on a game for some time now (Bomberman, MAYBE FutureDisk
will show a demo of it on the Bussum-fair) but I'm having some troubles with
generating random numbers. I'm now using the refresh register which I add
Below I pasted an assembly source of a random number generator that uses
an
algorithm based on multiplication with a prime number and XOR-ing with a
fixed mask.
In its current form, it produces numbers in the range 0..27, but you can
easily change that. You have to know that the middle
In stead of adding 'R' to the previous offset, try adding the joystick
inputs. Or rotate/shift the offset every button-press. User input is often
the best way of creating random numbers :)
A bit of XOR'ing here and there is not a bad idea either.
That sounds like a good idea too. I'll
On Sat, 26 Aug 2000, you wrote:
In its current form, it produces numbers in the range 0..27, but you can
easily change that. You have to know that the middle bits of the seed are
the most "random", so use those for the result.
Thanks Maarten. And yes, I knew that the middle bits of R
Albert Beevendorp wrote:
ld a,r
ld b,a
ld a,r
xor b
ld b,a
ld a,r
xor b
is a better way to randomize and repeating this more should improve it.
I don't think so, because the time it takes to repeat it is constant so R
will be increased with the same number all the time.
Greetz.
Arjan
12 matches
Mail list logo