Thanks Ron and Danny!
I knew that the random numbers are not truly random and that the seed cannot
be changed but the random number patterns I get now are pretty hefty, I
think this wasn't like that in AS2 times.
I will try to fumble with the date object to get a better seed.

Sascha



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Ron Wheeler
> Sent: Monday, 27 November, 2006 23:45
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] Whats the deal with AS3 Math.random?
> 
> Math.random generates psuedo-random numbers. If you want to have
> something that looks more random, try calling Math.random a random
> number of times before using the numbers.
> Use a true random number to determine the number of times to call it in
> the initial run.
> Suggestion: the modulus 100 of the number of milli-seconds since
> midnight (or some arbitrary date/time).
> This should give you at least 100 different pseudo-ransom strings.
> increase the modulus to get more.
> 
> I believe that you can get hardware devices that will give you truly
> random numbers, if that is really required.
> 
> As John von Neumann said in 1961 "Anyone who considers arithmetical
> methods of producing random digits is of course, in a state of sin."
> 
> We are all forced to chose between lesser and greater sins by our need
> for economical solutions.
> 
> Ron
> 
> Sascha wrote:
> > Hi,
> >
> > Why is it when I use Math.random to generate 10 random integers I get
the
> > same pattern of numbers almost every time. Starting the SWF movie ten
times
> > and I have 6-8 times the same pattern of numbers. What's going on there?
> > Almost looks as if the compiler sets pre-compiled numbers.
> >
> > Using this ...
> >
> >                     var str:String = "";
> >
> >                     for (var i:int = 0; i < 10; i++)
> >                     {
> >                             str += Math.floor(Math.random() * 100) + ",
> > ";
> >                     }
> >                     trace(str);
> >
> > ... and running the SWF movie ten times, I get this ...
> >
> > 88, 87, 35, 69, 73, 11, 93, 40, 39, 19,
> > 43, 69, 70, 96, 39, 97, 8, 74, 29, 65,
> > 50, 32, 82, 45, 39, 74, 96, 5, 7, 9,
> > 50, 32, 82, 45, 39, 74, 96, 5, 7, 9,
> > 50, 32, 82, 45, 39, 74, 96, 5, 7, 9,
> > 50, 32, 82, 45, 39, 74, 96, 5, 7, 9,
> > 50, 32, 82, 45, 39, 74, 96, 5, 7, 9,
> > 88, 87, 35, 69, 73, 11, 93, 40, 39, 19,
> > 50, 32, 82, 45, 39, 74, 96, 5, 7, 9,
> > 88, 87, 35, 69, 73, 11, 93, 40, 39, 19,
> >
> > This is the first time I experience this.  Is there any solution to fix
> > this?
> >
> > Thanks,
> > Sascha
> >
> >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> >
> >
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to