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 » Scripters
Home Search
 

Re: Can math.random have decimals?

Previous Thread :: Next Thread 
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
08 Jul 2015 11:34 PM
like this?
randomxz = math.random(0.4,1)
randomy = math.random(0.8,1.8)
x.Size = Vector3.new(randomxz,randomy,randomxz)
Report Abuse
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
08 Jul 2015 11:34 PM
im pretty sure it can


<3 cats <3
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
08 Jul 2015 11:35 PM
yes
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
08 Jul 2015 11:37 PM
Nope.
Report Abuse
ComradeREKTangle is not online. ComradeREKTangle
Joined: 07 Feb 2010
Total Posts: 850
08 Jul 2015 11:38 PM
i think its a whole number only not sure
Report Abuse
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
08 Jul 2015 11:39 PM
If you did it like this, then yes.

local whole = math.random(1,10)
local decimal = math.random(0,9)

print (whole..decimal)
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
08 Jul 2015 11:41 PM
do this

local randomxz=math.random(0.4*100,1)
x.Size=Vector3.new(randomxz/100,0,0)
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
08 Jul 2015 11:44 PM
or

function randomDecimal(num1,num2)
return math.random(num1%1==0 and num1 or num1*100,num2%1==0 and num2 or num2*100)/100
end
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
09 Jul 2015 12:06 AM
who cares just do math.random(0,100)/math.random(1,100)
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
09 Jul 2015 12:15 AM
or if you don't want to get ridiculously erratic non terminating numbers, do this

math.random(0,100)/100
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
09 Jul 2015 12:18 AM
or, my favourite,
tick()/math.random(0,100)-math.floor(tick()/math.random(0,100))
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
09 Jul 2015 12:20 AM
now that's just uneccesary. also you don't get to restrict the range of the number
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
09 Jul 2015 12:22 AM
woops forgot
(tick()/math.random(0,100)-math.floor(tick()/math.random(0,100)))%math.random(0,100)
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
09 Jul 2015 12:22 AM
wait nvm what i just did doesnt return a decimal.
the one before does!!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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