TameDrone
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 1006 |
|
|
| 28 Dec 2011 01:48 PM |
To make something randomly happen would it be:
Math.Random()? |
|
|
| Report Abuse |
|
|
TameDrone
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 1006 |
|
|
| 28 Dec 2011 01:48 PM |
| Without the question mark at the end? |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 01:51 PM |
You have to specify what is going to 'randomly happen'.
Such as a random brickcolor, random part, etc.. |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 28 Dec 2011 02:07 PM |
It should be math.random(). I don't think it works if you have either word as starting with a capital.
What that does is return a random number, specified by the first and second parameters in the brackets. For example, math.random(5, 10) would return a random number between five and ten. Then, you can use if's to have that as a larger random effect. |
|
|
| Report Abuse |
|
|
TameDrone
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 1006 |
|
|
| 28 Dec 2011 02:16 PM |
math.random(5, 10)
Wouldn't that make it to where it either picks 5 or 10 rather than a number between them? |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 02:17 PM |
| It could pick 5 or 10, but it would most likely pick a number between the two. |
|
|
| Report Abuse |
|
|
TameDrone
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 1006 |
|
|
| 28 Dec 2011 02:19 PM |
| What if I want it to be either 5 or 10, but no number between them? |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 02:20 PM |
If your using math.random(5, 10) you wouldn't be able to control whether it picked a number between them or not.
The only way to do that is to do math.random(9, 10)
^ Or something in that format. |
|
|
| Report Abuse |
|
|
TameDrone
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 1006 |
|
|
| 28 Dec 2011 02:32 PM |
| Ok then how would I make it pick one out of the two numbers, 5 or 10 if I only wanted one of those numbers to picked? |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 02:34 PM |
print(5) print(10)
:P
You can't do what your asking with math.random |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 02:36 PM |
Put them in a table. Randomly pick one out of the table.
~ [I don't script scripts; I script IMPORTED scripts.] [The inner machinations of my mind are an enigma.] ~ |
|
|
| Report Abuse |
|
|
TameDrone
|
  |
| Joined: 09 Dec 2010 |
| Total Posts: 1006 |
|
|
| 28 Dec 2011 02:40 PM |
| So there's no way I can make it randomly pick one of those two different numbers? |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 02:40 PM |
Like I said, put them in a table. >.<
~ [I don't script scripts; I script IMPORTED scripts.] [The inner machinations of my mind are an enigma.] ~ |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 02:43 PM |
| local number = math.random(10) <= 5 and 5 or 10 |
|
|
| Report Abuse |
|
|