# Random Number from 1-500

**URL:** <https://forum.kirupa.com/t/random-number-from-1-500/35618>\
**Category:** flash\
**Created:** [November 16, 2003, 1:32am UTC](https://forum.kirupa.com/t/random-number-from-1-500/35618 "2003-11-16T01:32:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soul814](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Soul814](https://forum.kirupa.com/u/Soul814)\
**Post date:** [November 16, 2003, 1:32am UTC](https://forum.kirupa.com/t/random-number-from-1-500/35618/1 "2003-11-16T01:32:39Z")

</div>

how do you do a random number from 1-500?

math.round(math.random(1)\*10); \<-- that only goes from 0-10 lol…

i tried loops and stuff but it didnt work out… 😕 i also tried adding a buncha math.randoms but the number was always pretty high…

im using it for this  
[http://www.toon-network.com/first.html](http://www.toon-network.com/first.html)  
click on the wack-a-mole title… thatz where im using the random thing… but half the time its off the screen since i used exponents…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 1:52am UTC](https://forum.kirupa.com/t/random-number-from-1-500/35618/2 "2003-11-16T01:52:48Z")

</div>

I’m not sure on this… but if putting \*10 goes from 0-10… wouldn’t \*500 go from 0-500?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 1:54am UTC](https://forum.kirupa.com/t/random-number-from-1-500/35618/3 "2003-11-16T01:54:47Z")

</div>

it would be

[AS]  
Math.round(Math.random(1)\*500);  
[/AS]

just set it to a dynamic text box to try it. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 2:00am UTC](https://forum.kirupa.com/t/random-number-from-1-500/35618/4 "2003-11-16T02:00:02Z")

</div>

[AS]Math.floor(Math.random()\*500)+1;[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 16, 2003, 2:02am UTC](https://forum.kirupa.com/t/random-number-from-1-500/35618/5 "2003-11-16T02:02:50Z")

</div>

o god was i stupid lol… \*\*\*\* why didnt i think of that instead of trying to do loops and stuff

thx

* * *

floor is the same thing as round… if i remeber it from c++ lol… floor just kills off the decimal places…
