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
 

Re: math.random with decimals?

Previous Thread :: Next Thread 
Vampyroteuthiss is not online. Vampyroteuthiss
Joined: 17 Jun 2010
Total Posts: 11541
22 Feb 2014 11:02 AM
So with this from the wiki:

for _ = 1, 10 do
print(math.random(100))
wait(1)
end

How would I make it so it prints number between 0 and .3
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
22 Feb 2014 11:03 AM
print(math.random(30)/100)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
22 Feb 2014 11:06 AM
/\ yep
Report Abuse
Vampyroteuthiss is not online. Vampyroteuthiss
Joined: 17 Jun 2010
Total Posts: 11541
22 Feb 2014 11:08 AM
Ok, Thats for 0 to .3? Thanks
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
22 Feb 2014 11:11 AM
Yep,that from 0.0 to 0.3
If u wanted from 0 to 3
print(math.random(30)/10)
output would be all like:
-2.5
-1.3
-0.6
Report Abuse
gamehero is not online. gamehero
Joined: 12 Jun 2007
Total Posts: 1455
22 Feb 2014 11:18 AM
I personally like doing this to print randomized decimals.



print(math.random())

Or this...

print(math.random()*0.3)



But it prints numbers like this:
0.123182375
0.294211344
0.011231231

If that's not what you want, then yeah... Just use the first one.
Report Abuse
Vampyroteuthiss is not online. Vampyroteuthiss
Joined: 17 Jun 2010
Total Posts: 11541
22 Feb 2014 11:20 AM
Oh I see it now. So could you do:

math.random(3)/10 Instead?
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