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: Printing numbers between two numbers randomly

Previous Thread :: Next Thread 
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
29 May 2014 02:56 PM
Instead of putting all numbers in a table like to print a random number like:

R = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}
RNum = R[1,math.random(1,#R)]

print(RNum)

--How would you simplify that because I'm trying to randomize about 1000+ numbers.
Report Abuse
Jonibus is not online. Jonibus
Joined: 30 Jan 2010
Total Posts: 8985
29 May 2014 02:57 PM
print(math.random(1,1000))
> Prints a random number between 1 and 1000

If you want to save that number, assign it to a variable;
randomnum = math.random(1,1000)
print(randomnum)

Follow me on twitter: @Jonibus_RBX
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
29 May 2014 02:58 PM
print(math.random(1, 20)) -- Prints random numbers between 1- 20.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
29 May 2014 04:27 PM
ohhhh!! I thought math.random() means that i can only use two values.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
29 May 2014 04:28 PM
thx btw
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