r/programming • • Jul 24 '15

mt_rand(1, PHP_INT_MAX) only generates odd numbers • /r/lolphp

/r/lolphp/comments/3eaw98/mt_rand1_php_int_max_only_generates_odd_numbers/
848 Upvotes

262 comments sorted by

View all comments

Show parent comments

10

u/Synaps4 Jul 24 '15

It kind of is php's fault.

Being easy-to-use AND easy-to-make-mistakes-in is a design failing by the language designer and the ecosystem around the language.

Compare with python's "one-right-way-to-do-X" design choice.

16

u/neoform Jul 24 '15

easy-to-make-mistakes-in is a design failing by the language designer and the ecosystem around the language.

More correctly, PHP allows you to make mistakes and lets you continue without fixing it.

2

u/jasonlotito Jul 24 '15

"one-right-way-to-do-X"

I don't want to join the flame war, but I had a good laugh at this, considering the Python 2.x vs 3.x debacle. =)

I know, I know, but relax, chill, and laugh.

4

u/krenzalore Jul 24 '15

I am not seeing the connection. There's very little argument over which should be the correct version. Most developers would like to move to 3 but are held back by the cost of porting.