generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Math.random for decimals?

Previous Thread :: Next Thread 
Cautionary is not online. Cautionary
Joined: 07 Jun 2012
Total Posts: 5647
22 Feb 2014 11:36 AM
Please help.
I want something like math.random(1,100)
but instead of having whole numbers, I want to decimals too.
Report Abuse
Jammintoad is not online. Jammintoad
Joined: 08 Feb 2009
Total Posts: 10239
22 Feb 2014 11:59 AM
what if you did it out of 1000 then divided by 10. hm idk
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
22 Feb 2014 12:04 PM
local x = math.random(1, 100)
x = x / 100


(100 would become 1, 50 would become 0.5)
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
22 Feb 2014 12:05 PM
Oh wait, you mean you want 1 - 100 including decimals?
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
22 Feb 2014 12:05 PM
math.random() with no arguments returns a random decimal between 0 and 1.

You could do:

local x = math.random()
x = x * 100
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image