|
| 03 Mar 2015 07:08 PM |
I was wondering, how does math.random work, assuming you pass it only 1 value, instead of the usual 2?
i.e. math.random(5) |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2015 07:09 PM |
Between 1 and the given argument.
That example is equivalent to math.random(1, 5) |
|
|
| Report Abuse |
|
|
ChoongJae
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 670 |
|
|
| 03 Mar 2015 07:10 PM |
it automatically assumes the 1st argument as 1 in that situation so
math.random(10) == math.random(1,10) |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Mar 2015 07:14 PM |
math.random(1,4)
4 2 1 3 4 2 1 3 4 2 1 3 -- It will print the same pattern, unless you do math.randomseed(tick()) |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2015 07:36 PM |
math.random() returns a decimal between 0 and 1
math.random(n) returns an integer between 1 and n
math.random(n, x) return an integer between n and x |
|
|
| Report Abuse |
|
|