From: Fabien Potencier Date: Thu, 26 Jan 2012 12:24:26 +0000 (+0100) Subject: merged branch Tobion/patch-4 (PR #614) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=197a3115c7dff5597668d13fc418e1e42d000488;p=web%2Fkonrad%2Ftwig.git merged branch Tobion/patch-4 (PR #614) 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 --- 197a3115c7dff5597668d13fc418e1e42d000488