🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.sys.amiga.demos
3 messages
3 total messages Started by Moria Beledain Mon, 25 Jan 1993 17:55
pseudo random numbers
#801
Author: Moria Beledain
Date: Mon, 25 Jan 1993 17:55
26 lines
981 bytes
pfibl.
i am looking for a Good pseudo random number generator. 
the one i am using now was by Leo Schwabb many years ago, and
i have modified it to now and then EOR in some clock counter
etc..  But i am still not satisfied!
 
so who knows some good ideas ?
.. Maybe a routine to use the HPos..  It has periods of
very fast fluctuation which if polled slow enough could seem
quite random..
.. hmm
rnd
	move.w	seed,d0
 	lsl.w	#4,d0
	eor.b	HPOS,d0
	move.w	d0,seed
	rts
 
.. Hmmm
Yes the hpos also has periods of constancy, but so you filter those, and
do something else in addition.

????
 
orion
Re: pseudo random numbers
#804
Author: Lars Haugseth
Date: Tue, 26 Jan 1993 09:09
46 lines
1595 bytes
In article <1k19ioINN7l8@darkstar.UCSC.EDU>, moria@ucscb.UCSC.EDU (Moria Beledain) writes:
> 
> pfibl.
> i am looking for a Good pseudo random number generator. 
> the one i am using now was by Leo Schwabb many years ago, and
> i have modified it to now and then EOR in some clock counter
> etc..  But i am still not satisfied!
>  
> so who knows some good ideas ?
> .. Maybe a routine to use the HPos..  It has periods of
> very fast fluctuation which if polled slow enough could seem
> quite random..
> .. hmm
> rnd
> 	move.w	seed,d0
>  	lsl.w	#4,d0
> 	eor.b	HPOS,d0
> 	move.w	d0,seed
> 	rts
>  

Here's how I do it, and I get pretty good results :

GETRND:	moveq	#0,d0
	moveq	#0,d1
	move.b	$DFF007,d0
	move.b	$BFD800,d1
	eor.b	d1,d0
	rts

This following is better, but takes more cycles :

GETRND:	moveq	#0,d0
	move.b	$DFF007,d0
	move.b	$BFD800,d1
	eor.b	d1,d0
	move.b	d0,d1
	and.w	#15,d1
GRND1:	dbf	d1,GRND1
	rts

The loop is done so that the time between my bsr GETRND 's will
wary slightly to produce 'more random' numbers.

Lars
Re: pseudo random numbers
#905
Author: L Lundman
Date: Tue, 26 Jan 1993 19:49
45 lines
2029 bytes
In article <1993Jan26.090949.4643@ifi.uio.no> larshaug@ifi.uio.no (Lars Haugseth) writes:

>   Here's how I do it, and I get pretty good results :
>
>   GETRND:	moveq	#0,d0
>	   moveq	#0,d1
>	   move.b	$DFF007,d0
>	   move.b	$BFD800,d1
>	   eor.b	d1,d0
>	   rts
>
>   This following is better, but takes more cycles :
>
>   GETRND:	moveq	#0,d0
>	   move.b	$DFF007,d0
>	   move.b	$BFD800,d1
>	   eor.b	d1,d0
>	   move.b	d0,d1
>	   and.w	#15,d1
>   GRND1:	dbf	d1,GRND1
>	   rts
>
>   The loop is done so that the time between my bsr GETRND 's will
>   wary slightly to produce 'more random' numbers.
>
>   Lars
>

Another way you could add some randomness is to have a table of 256 bytes
(That is each byte only occuring once but in a random place. No repeats)

So when you get a random byte with one of the routine above you can index
into this array and get a new unique value, and using that index in again.

About three time makes it look fairly random. I used this to do a fade/morph
routine between two pictures.

Kef
--
-------------------------------------------------------------------------------
Jorgen Lundman         eMail: lundman@kauri.vuw.ac.nz, lundman@rata.vuw.ac.nz.
8 Atua Street          My thoughts are my own and not VUW's..
Johnsonville,wgtn      "Research indicate that only 21 percent of what goes
New Zealand            wrong here is actually my fault."
Phone: +64 4 478 2724 (GMT+11 hrs) Amiga Archive Admin on ftphost.vuw.ac.nz
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads