<p dir="ltr">On Sep 10, 2015 5:29 AM, "Paul Moore" <<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>> wrote:<br>
[...]<br>
> You're claiming that the random<br>
> module is security related. I'm claiming it's not, it's documented as<br>
> not being, and that's clear to the people who use it for its intended<br>
> purpose. Telling those people that you want to make a module designed<br>
> for their use harder to use because people for whom it's not intended<br>
> can't read the documentation which explicitly states that it's not<br>
> suitable for them, is doing a disservice to those people who are<br>
> already using the module correctly for its stated purpose.</p>
<p dir="ltr">Regarding the "harder to use" point (which is obviously just one of many considerations in this while debate):</p>
<p dir="ltr">I trained myself a few years ago to stop using the global random functions and instead always pass around an explicit RNG object, and my experience is that once I got into the habit it gave me a strict improvement in code quality. Suddenly many more of my functions are deterministic ... well ... functions ... of their inputs, and suddenly it's clearly marked in the source which ones have randomness in their semantics, and suddenly it's much easier to do things like refactor the code while preserving the output for a given seed. (This is tricky because just changing the order in which you do things can break your code. I wince in sympathy at people who have to maintain code like your map-generation-from-a-seed example and *aren't* using RNG objects explicitly.) The implicit global RNG is a piece of global state, like global variables, and causes similar unpleasantness. Now that I don't use it, I look back and it's like "huh, why did I always used to hit myself in the face like that? That wasn't very pleasant." So this is what I teach my collaborators and students now. Most of them just use the global state by default because they don't even know about the OO option.</p>
<p dir="ltr">YMMV but that's my experience FWIW.</p>
<p dir="ltr">-n</p>