# Why is random() deprecated?

**URL:** <https://forum.kirupa.com/t/why-is-random-deprecated/159278>\
**Category:** flash\
**Created:** [August 16, 2005, 10:56am UTC](https://forum.kirupa.com/t/why-is-random-deprecated/159278 "2005-08-16T10:56:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chic0](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@chic0](https://forum.kirupa.com/u/chic0)\
**Post date:** [August 16, 2005, 10:56am UTC](https://forum.kirupa.com/t/why-is-random-deprecated/159278/1 "2005-08-16T10:56:17Z")

</div>

I always simply use random() for calculating random numbers, since I read [one of :sen:'s best](http://www.kirupa.com/forum/showthread.php?s=&postid=81617). And I like it a lot.  
Only to generate a float of random numbers I use Math.floor(Math.random()\*(max-min+1)) + min

So, this time I had to use both in one script, and I had it checked by a friend who is a way better developer as I am (as far as I’m a developer :lol: ).  
He advised me to leave the random() behind.  
I replied that there is no reason to, since it sometimes really is a hassle to use “Math.floor(Math.random()\*(max-min+1)) + min” when u simply want a random number. “ **And** it’s way faster!”, I added.

“I know, I know”, he said, “but it’s deprecated”. :h:

Why is it deprecated??? It has 2 advantages: it’s shorter and it calculates faster. So I don’t understand why people at MM put it at the deprecated elements.

I will keep using random() for sure… cuz imo both random() and [size=1]that other code [/size][size=2]have their advantages.[/size]
