25.02.2009, 06:26
A way to think of random() is that the 'max' paramater you input is the amount of possible values returned. For example:
INPUT
POSSIBLE OUTPUTS
1
0
2
0, 1
3
0, 1, 2
4
0, 1, 2, 3
Notice how the input value is the amount of possible outputs, so using that you can figure out that a 'max' of 10 will give you 10 possible outputs, and because they can not be negative and start at 0, they must be 0 through to 9.
Hope it helps![Wink](images/smilies/wink.png)
INPUT
POSSIBLE OUTPUTS
1
0
2
0, 1
3
0, 1, 2
4
0, 1, 2, 3
Notice how the input value is the amount of possible outputs, so using that you can figure out that a 'max' of 10 will give you 10 possible outputs, and because they can not be negative and start at 0, they must be 0 through to 9.
Hope it helps
![Wink](images/smilies/wink.png)
~Cueball~