Commits
-------
a15e8f7 typo again
2561aa2 typo
faa90c9 updated doc for random function
fe66358 added tests for random function
6f5ceee Made the random function more versatile
Discussion
----------
Made the random function more versatile
The point is to meet user expectations and to make it more versatile, so it works under more circumstances.
At the moment the random function does only return the supplied parameter when it's not an array. That is not very useful. With this PR it will behave like
random() => integer as with mt_rand()
random(5) => integer between 0 and 5 as with mt_rand(0, 5)
random('foobar') => random character from 'foobar'
random(array(...)) => random element
I will add tests and documentation if you accept this PR.
---------------------------------------------------------------------------
by fabpot at 2012-01-26T07:29:35Z
Looks good to me. Can you update the docs and add some unit tests?
---------------------------------------------------------------------------
by Tobion at 2012-01-26T11:50:17Z
ready