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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
| |