DPRG
DPRG List  



DPRG: BOUNCE dprglist@dprg.org: Non-member submission from [David Ferguson <davidfer@microsoft.com>]

Subject: DPRG: BOUNCE dprglist@dprg.org: Non-member submission from [David Ferguson <davidfer@microsoft.com>]
From: Jim Brown jimbrown at airmail.net
Date: Wed Jan 14 18:46:56 CST 1998

>Return-Path: <owner-dprglist at dprg.org>
>Date: Wed, 14 Jan 1998 16:13:40 -0600
>From: owner-dprglist at dprg.org
>X-Authentication-Warning: horta.ncc.com: mail set sender to
owner-dprglist at dprg.org using -f
>To: owner-dprglist at dprg.org
>Subject: BOUNCE dprglist at dprg.org:    Non-member submission from [David
Ferguson <davidfer at microsoft.com>]   
>
>>From dprglist-owner at horta.ncc.com  Wed Jan 14 16:13:23 1998
>Received: from nimon.ncc.com (nimon.ncc.com [199.1.173.2])
>	by horta.ncc.com (8.8.5/8.8.5) with SMTP id QAA05016
>	for <dprglist at horta.ncc.com>; Wed, 14 Jan 1998 16:13:22 -0600
>Received: from davidfer at microsoft.com [131.107.3.41] by nimon.ncc.com
(OS/2 NCCmail v0.33) with SMTP
>          for dprglist at dprg.org; Wed, 14 Jan 98 14:57:18 CST
>Received: by INET-01-IMC with Internet Mail Service (5.5.1960.3)
>	id <C78R3BWT>; Wed, 14 Jan 1998 13:08:37 -0800
>Message-ID:
<2F2DC5CE035DD1118C8E00805FFE354C019BF574 at red-msg-56.dns.microsoft.com>
>From: David Ferguson <davidfer at microsoft.com>
>To: "Dickens, Thomas P" <Thomas.Dickens at PSS.Boeing.com>,
>        DPRG
>	 <dprglist at dprg.org>,
>        seattle robotics society <srs at seattlerobotics.org>,
>        "'robojoc at postoffice.worldnet.att.net'"
>	 <robojoc at postoffice.worldnet.att.net>
>Subject: RE: "Random" Numbers
>Date: Wed, 14 Jan 1998 13:08:35 -0800
>X-Mailer: Internet Mail Service (5.5.1960.3)
>
>One of the Frederick Mimms III booklets at Rat Shack has a white noise
>generator circuit.  It's pretty straightforward.  I believe it was the
>Semiconductors booklet.
>
>Dave
>Dulcius ex Asperis
>
>	-----Original Message-----
>	From:	Dickens, Thomas P [SMTP:Thomas.Dickens at PSS.Boeing.com]
>	Sent:	Wednesday, January 14, 1998 9:54 AM
>	To:	DPRG; seattle robotics society;
>'robojoc at postoffice.worldnet.att.net'
>	Subject:	RE: "Random" Numbers
>
>
>	A random-number routine I've run across which I like is:
>
>	
>/***********************************************************************
>	*
>	**********************      Random With Seed
>	***********************
>	
>************************************************************************
>	/
>	double      random_with_seed( long number )
>	{
>
>	union {
>	   unsigned long      next;
>	   struct {
>	      unsigned short      : 1  ;
>	      unsigned short     n : 15 ; } bits;
>	} seed ;
>	 
>	seed.next = number * 1103515245 + 12345 ;
>	return( (double)seed.bits.n / 32767.0 ) ;   /** return 0.0 to 1.0
>**/
>	}
>	 
>	Of course for the HC11 we would not convert the result to a 0.0 to
>1.0
>	float.
>
>	Another approach to randomness in electronics is to generate white
>noise
>	and to sample the voltage level at a discrete point in time (with an
>	analog
>	E-port input on the HC11).  I've seen references that this can
>easily be
>	done using a simple transistor circuit. 
>
>	Anyone know the details on this???
>
>	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
>	Tom Dickens    thomas.p.dickens at boeing.com
>
>	> ----------
>	> From: 	Eric B. Olsen[SMTP:robojoc at worldnet.att.net]
>	> Sent: 	Monday, January 12, 1998 9:15 PM
>	> To: 	DPRG; seattle robotics society
>	> Subject: 	"Random" Numbers
>	> 
>	> Hi all,
>	> 
>	> Regarding random number generators, I have taken someone's advice
>out
>	> there and looked in to my Numerical Recipes in C book!  The
>write-up
>	> turned out to be very interesting ... The truth about many RNG's
>out
>	> there is that they are not very good at all, and while even bad
>random
>	> number generators may work for given robotic application, why use
>them
>	> if there's something better?
>	> 
>	> In my gaming experience, I 've come across several different forms
>of
>	> algorithms; two of the most dominent are "linear congruential
>type",
>	> and
>	> "shift register feedback" type.  I've chosen to list the former
>type
>	> as
>	> this is documented in the Numerical Recipes book and has test
>	> references
>	> available.
>	> 
>	> The routine is documented as a quick and fast method that yields
>	> acceptable results.  The book also instructs that 32 bit RNG's are
>	> highly preferred over other shorter sequence algorithms.  The
>routine
>	> is:
>	> 
>	> 
>	> 
>	> unsigned long idum;
>	> 
>	> idum = 1664525L * idum + 1013904223L;
>	> 
>	> 
>	>  That's it!  Everytime you need a number, execute the recurrence
>	> equation (remember, don't trash 'idum', it'll be needed exactly as
>is
>	> in
>	> the next call).  The seed value is any number that you initially
>start
>	> idum with.
>	> 
>	> If you need a floating point number, a (somewhat dirty) trick that
>is
>	> documented in the book as follows: (which is apparently specific
>to
>	> IEEE
>	> format floating point numbers)
>	> 
>	> 
>	> unsigned long idum, itemp;
>	> float rand;
>	> 
>	> static unsigned long jflone = 0x3f800000;
>	> static unsigned long jflmsk = 0x007fffff;
>	> 
>	> idum  = 1664525L * idum + 1013904223L;
>	> itemp = jflone | (jflmsk & idum);
>	> rand = (*(float *)&temp)-1.0;
>	> 
>	> 
>	> Of course, the down side to these routines is the need for 32 bit
>	> integer operations, however, this is required if the RNG is going
>to
>	> yeild minimally acceptable results in terms of sequence length
>(repeat
>	> period).
>	> 
>	> The book also mentions that to generate a range of random numbers,
>it
>	> is
>	> best to use the most significant digits of the number as opposed
>to
>	> the
>	> least significant bits, thus, when requiring a random number
>between 1
>	> and 10, you should use something like:
>	> 
>	> j = 1 + (int)(10.0 * rand( ) / (RAND_MAX + 1.0))
>	> 
>	> of course, notice that this means you have floating point
>available.
>	> 
>	> The book says that forms like:
>	> 
>	> j = 1 + (rand( ) % 10)
>	> 
>	> are not recommended as they use lower order bits...although I'll
>have
>	> to
>	> admit I've used these when the generators are "free-running".
>	> 
>	> You'll have to take the above statements and place them into a
>	> function
>	> call, remembering that "idum" is a global variable.
>	> 
>	> In electronic gaming devices, another trick is used to keep the
>	> randomness of the generator very high, that is, keep the RNG
>	> "free-running" in the background, perhaps in a timer interrupt if
>	> possible.  (Free running means the generator keeps pulling numbers
>	> regardless of whether they are needed or not!)  This means that
>you'll
>	> have to structure a routine to retreive a valid state of the RNG,
>	> which
>	> can be a bit tricky  (disable interrupts!!) ... however, the
>results
>	> are
>	> amazing since your gnerator generates a "random" number, not just
>	> "psuedo-random numbers"!   i.e. the real world is influencing when
>the
>	> numbers are pulled from a generator that is constantly going!
>	> 
>	> Hope some of this stuff's been useful!
>	> 
>	> 
>	> Eric Olsen
>	> 
>	> --
>	> 
>	> "Time will tell if the human race can handle the responsibility of
>	> it's
>	> own evolution"
>	> 
>	> Spectronix, Inc.
>	> Fax:
>	> Email:  robojoc at worldnet.att.net
>	> Web-Site:
>	> Henderson, NV
>	> 
>	> 
>
>
>
>
- - - ____ - - - - - - ___ - - - - - - - - - - - - - - - - - - - - - - - - - -
    \/\_\@  ____    /  /\ __  ___          ___    http://www.dprg.org 1-17
    / / /\ / / /\  /--/ //\_\/\_/\ /\/\/\ /\_/\  http://users.why.net/jbrown
/__/ / / // / / / /__/ // / /__/ //_/_/ // // / (972)519-2868, (972)495-3821
\__\/  \/ \/\/\/  \__\/ \/  \__\/ \_\_\/ \/ \/ jgbrown at spdmail.spd.dsccc.com

------------------------------

More information about the DPRG mailing list