Need an answer quick: Random()

Haha, good point, it does work though david. That is what I have been meaning to ask you but forgot.

I know it is written as Math.random()*3 (and that is how I always write it), but why is Math.random(3) considered improper syntax when it works perfectly fine?

hmm… I don’t know. I’ve just always believed that it wouldn’t work. Perhaphs I just haven’t experiemented with it.

Ah yes, after re-experimenting with it while using the trace function, I found it only returns 1’s and 0’s if you have it has Math.random(3)… makes me wonder what I did different when I first tested it…eh oh well, I still know I do it right now.

using Math.random(3); I came up with these number out of ten tries

0.182616225528818
0.246697391498227
0.496306900166118
0.294558602056726
0.0384465507410683
0.804301160762227
0.274645778944085
0.671068015820844
0.376926560130402
0.70065694567778

using Math.random()*3; I came up with these

1.44232590051476
2.42299682899518
0.169483414930051
0.996716877909711
1.47894309949081
1.74336946464301
1.63587004488142
2.7064569735464
0.101575112948928
1.76893623628138

So the Math.random(3); is not working. Not the way random is supposed to work anyway.

you probebly did

random(3);

the first time. That is depricated, but it still works, and will do a random 1 through 3

I just used Math.round when I did it because all of those decimals get on my nerves…:slight_smile: I got…

1
1
1
0
0
1
0
1

You get the point.

I Probably did. It was back when I tried AS for the very first time.

Thanks for all the help guys! (and gals :wink: )

Just a little something:

storage=New array("cookie","box","spoon");
something=storage[Math.floor(Math.random()*storage.length-1)];

would be better if the length of storage changes.

pom :asian:

Smart Pom… always thinking.

It’s Pom, who would expect less:)

:blushing:

And Lost, I’ve just noticed you have more posts than Upu himself! Now correct me if I’m wrong, Upu, but I don’t think this has ever happened to you, has it? Even on the old forums?

pom :stuck_out_tongue:

Sorry david. Haha, it looks like im truckin’ for that 1000 mark:)

Yes this is true. Our little upstart Lostinbeta has surpassed even my long windedness. Pretty impressive. It probebly happened because I’ve been spending a lot more time working and less socializing over the last two months. I still have so much to do. I get into Flash slumps (as we all do) which last a month or so… when that happens I do a lot more posting than work. Who knows maybe I can blow him out in October. (I tend to think not though… he’s a great asset and one of the reasons I feel I can take the time to work instead of post. :slight_smile: thanks again for that beta)

Oh great, now I am blushing. Thanks david:)

OK, as August’s Pseudo-King of the forum, I designate Lost September’s King of the forum. :slight_smile:

pom :asian:

Wow, now I am blushing even more. I have never been a Pseudo-King before!:slight_smile:

What are my duties as Psuedo-King of the month?

[SIZE=1]I don’t know![/SIZE] But you could, for instance, write a tutorial about an effect you really like. I kinda did that with the perspective thing, even though I can’t get it finished… :*(

Here’s your mission, Pseudo-King: [SIZE=3]amaze us![/SIZE]

pom :asian:

Ok, I will work on that tomorrow. For now, I am off to bed, I am not tired, but it is 3:45am so I should be getting to bed.

Do you have an idea yet? :slight_smile: