convert a list to a string

Paul Rubin http
Thu Jan 8 22:48:38 EST 2004


Bart Nessux <bart_nessux at hotmail.com> writes:
> How does randint and sample differ? I was under the impression that
> sample was more random.

No, they both use the same underlying generator.

randint gives you one random number, which is what you want.
sample takes a list and selects some elements from it.

As I mentioned in another post, the underlying generator is designed
to have good statistical properties for doing things like simulations.
It's not designed to withstand someone actively trying to predict the
next random number based on the previous output stream.  If you're using
it in an application like a high-stakes online game, where players have
significant incentive to predict the output, then you should get your
random numbers a different way.  Doing that kind of thing properly
takes a lot of skill though--it's not something newbies should attempt.



More information about the Python-list mailing list