Searching \ for 'Generating Random Numbers?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/method/math.htm?key=random
Search entire site for: 'Generating Random Numbers?'.

Truncated match.
PICList Thread
'Generating Random Numbers?'
2000\05\06@193718 by Ben R.

picon face
<x-flowed>Hey, does anyone out there know anything about generating random numbers in
ASM code, or perhaps where I can learn more about the theory behind it so I
can write my wn code? I f could just just get someone else's code that of
course would be easier... Thank you.

                                 -Ben
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

2000\05\06@193922 by Andrew Warren

face
flavicon
face
Ben R. <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> Hey, does anyone out there know anything about generating random
> numbers in ASM code, or perhaps where I can learn more about the
> theory behind it so I can write my wn code? I f could just just
> get someone else's code that of course would be easier...

   Ben:

   http://home.netcom.com/~fastfwd/answers.html#PIC00075

   -Andy


=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - San Diego, California
=== http://www.geocities.com/SiliconValley/2499

2000\05\07@162812 by William Chops Westfield

face picon face
Speakinng of random numbers, I have a new (?) question.

How do I generate random numbers with a nice statical distribution, ie
ones that fit a standard bell-shaped curve.  Most random number generators
try to generate all possible combinations in an even distribution, but what
if I want numbers "near" "X", perhaps with a specified standard deviation...

BillW

2000\05\07@174202 by Plunkett, Dennis

flavicon
face
Why would you want a bell shape? Would not your ideal response be flat?

Dennis



{Quote hidden}

2000\05\07@181752 by Arthur

flavicon
face
It depends if the bell as a crack in it like the liberty bell or it may be
that it's tuned to the 3rd harmonic and I can't tell as I have tinatus
[excuse spelling as spelling checker wants to put in tetanus] from a thread
the other week my ears are still ringing
Regards Art :-)

----- Original Message -----
From: Plunkett, Dennis <EraseMEdplunkettspam_OUTspamTakeThisOuTAIRINTER.COM.AU>
To: <PICLISTspamspam_OUTMITVMA.MIT.EDU>
Sent: Sunday, May 07, 2000 10:36 PM
Subject: Re: Generating Random Numbers?


: Why would you want a bell shape? Would not your ideal response be flat?
:
: Dennis
:
:
:
: > {Original Message removed}

2000\05\07@194020 by Andrew Warren

face
flavicon
face
William Chops Westfield <@spam@PICLISTKILLspamspamMITVMA.MIT.EDU> wrote:

> How do I generate random numbers with a nice statical distribution,
> ie ones that fit a standard bell-shaped curve.  Most random number
> generators try to generate all possible combinations in an even
> distribution

Bill:

There are lots of algorithms, but if you only have a random-sequence
generator that gives an even distribution, you can STILL use it to
create a sequence that has a bell-shaped distribution.  Here's one
way:

   BELL_RANDOM:

       CLRF    OUTPUT      ;CLEAR THE OUTPUT REGISTER.

       MOVLW   100         ;SETUP TO GET 100 EVENLY-DISTRIBUTED
       MOVWF   COUNT       ;RANDOM NUMBERS.

   LOOP:

       CALL    RANDOM      ;W = A RANDOM NUMBER.
       ANDLW   10000000B   ;IS THE HIGH BIT SET?
       SKPZ                ;IF NOT, SKIP AHEAD.

       INCF    OUTPUT      ;OTHERWISE, INCREMENT OUTPUT.

       DECFSZ  COUNT       ;DONE ENOUGH OF THEM?
       GOTO    LOOP        ;IF NOT, LOOP BACK.

       RETURN              ;OTHERWISE, RETURN WITH A "BELL-SHAPED"
                           ;RANDOM NUMBER IN "OUTPUT".

Of course, the above is just an example; it'd be better if your
"RANDOM" routine returned a number in a larger range than [0-255]...
But I'm sure you get the idea, which is that even "flat-distribution"
sequences have properties that can be used to generate a bell-shaped
distribution.

-Andy


=== Andrew Warren - KILLspamfastfwdKILLspamspamix.netcom.com
=== Fast Forward Engineering - San Diego, California
=== http://www.geocities.com/SiliconValley/2499

2000\05\07@194854 by Sean Breheny

face picon face
Hi Bill,

A bell curve (or Gaussian distribution) is easy because if you add together
a large number of random numbers taken from a uniformly-distributed
generator (like the type you describe), you will get some number, call it
x. If you repeat the process with different numbers from that generator and
get x2,x3,x4, etc., then the x's will have a distribution which
approximates a Gaussian. You can then get whatever standard dev. and mean
you want by just scaling and shifting the output. So, if the sequence
x,x2,x3,x4,.... has mean 0.5 and stdev 2, and you want mean=10 and sddev=6,
then the sequence 3*x+9.5,3*x2+9.5,3*x3+9.5,..... will have what you want.

I don't know how many numbers you will need to add together to generate
each output number, but from a some graphs I have in a book here, it looks
like about 10 to 20 would be adequate.

Sean

At 01:25 PM 5/7/00 PDT, you wrote:
>Speakinng of random numbers, I have a new (?) question.
>
>How do I generate random numbers with a nice statical distribution, ie
>ones that fit a standard bell-shaped curve.  Most random number generators
>try to generate all possible combinations in an even distribution, but what
>if I want numbers "near" "X", perhaps with a specified standard deviation...
>
>BillW
>
|
| Sean Breheny
| Amateur Radio Callsign: KA3YXM
| Electrical Engineering Student
\--------------=----------------
Save lives, please look at http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
RemoveMEshb7TakeThisOuTspamcornell.edu ICQ #: 3329174

2000\05\07@205029 by Sean Breheny

face picon face
OOPS, I just saw an error in my last post:

I wrote:
>So, if the sequence x,x2,x3,x4,.... has mean 0.5 and stdev 2, and you want
mean=10 and sddev=6,
>then the sequence 3*x+9.5,3*x2+9.5,3*x3+9.5,..... will have what you want.

Which should have been:

3*x+8.5,3*x2+8.5,3*x3+8.5,..... since the original had a mean of 0.5 which
contributes 1.5 when multiplied by 3. Sorry for any confusion.

Sean




At 01:25 PM 5/7/00 PDT, you wrote:
>Speakinng of random numbers, I have a new (?) question.
>
>How do I generate random numbers with a nice statical distribution, ie
>ones that fit a standard bell-shaped curve.  Most random number generators
>try to generate all possible combinations in an even distribution, but what
>if I want numbers "near" "X", perhaps with a specified standard deviation...
>
>BillW
>
|
| Sean Breheny
| Amateur Radio Callsign: KA3YXM
| Electrical Engineering Student
\--------------=----------------
Save lives, please look at http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
spamBeGoneshb7spamBeGonespamcornell.edu ICQ #: 3329174

2000\05\08@113247 by pandersn

flavicon
face
Ben...

You can use PN sequences to generate a random sequence. Use the words
"pseudo-random sequences" or "pseudorandom-number generators" in your web
search. These are outlined in most electronics textbooks on communications
such as those published by Prentice Hall or McGraw-Hill.

PN generators have application in noise generators and spread-spectrum key
generators, etc. Also used to build hardware bit-error-rate generators.


Phil.

On Saturday, May 06, 2000 6:36 PM, Ben R. [SMTP:TakeThisOuTben_r_EraseMEspamspam_OUTHOTMAIL.COM] wrote:
> Hey, does anyone out there know anything about generating random numbers
in
> ASM code, or perhaps where I can learn more about the theory behind it so
I
> can write my wn code? I f could just just get someone else's code that of
> course would be easier... Thank you.
>
>                                   -Ben
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

2000\05\08@195748 by Kevin Maciunas

flavicon
picon face
Not wishing to sound disheartening, the generation of RN's or even good
PRN's is really tricky.  I'd suggest you check out the random number
section of
http://www.mathcom.com/nafaq/index.html to source the information you
need.

This is a really, really well trodden field.

Cheers
/Kevin
---
Kevin J. Maciunas                               RemoveMEkevinspamTakeThisOuTcs.adelaide.edu.au
Department of Computer Science  PH: +61-8-8303-5586
The University of Adelaide              FAX:+61-8-8303-4366
Adelaide 5005 South Australia

2000\05\09@175048 by Plunkett, Dennis

flavicon
face
       This is totally correct, generation is not easy! Ask IBM about the
RNDU function that they had. Said it was random, seems that after a period
of time it is not, and a pattern emerges.
If you want some random numbers to put into a lookup table, try to find
those generated by the Random corp

Dennis




> {Original Message removed}

2000\05\09@193252 by Andy Kelley

picon face
maybe read an input 8 times putting the values into a byte.

might work.. i am not sure.

Andy K
N1YEW

On Wed, 10 May 2000 07:48:03 +1000 "Plunkett, Dennis"
<dplunkettEraseMEspam.....AIRINTER.COM.AU> writes:
{Quote hidden}

> > {Original Message removed}

2000\05\09@194537 by Kevin Maciunas

flavicon
picon face
Andy Kelley wrote:

> maybe read an input 8 times putting the values into a byte.
>
> might work.. i am not sure.
>
> Andy K
> N1YEW
>

**NO** - this does not generate a random number!  The resultant number is
correllated with the inputs.  My earlier posting in this thread has a
reference to a wealth of information on what to do/how to do it.

Random numbers are particularly important in cryptography; if you have
any doubts as to the consequences of poor random number selection, look
back to Netscape's original presentation on secure transmission of TCP
data.  It took people in the audience about 10 mins to devise a way to
bust it due to the insane choice of "random" number.  We should all
listen to history!

/Kevin

--
Kevin J. Maciunas           Net: EraseMEkevinspamcs.adelaide.edu.au
Dept. of Computer Science   Ph : +61 8 8303 5845
University of Adelaide      Fax: +61 8 8303 4366
Adelaide 5005
SOUTH AUSTRALIA

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...