Seeding the rand() Generator
fatkinson at mishmash.com
Tue Aug 4 14:58:46 CEST 2009
On Tue, 04 Aug 2009 07:12:30 GMT, Jarkko Torppa
<torppa at staff.megabaud.fi> wrote:
>On 2009-08-04, Fred Atkinson <fatkinson at mishmash.com> wrote:
>> On Mon, 3 Aug 2009 20:00:08 -0700 (PDT), Carl Banks
>><pavlovevidence at gmail.com> wrote:
>>>If you don't "get" why this is a MySQL question and not a Python
>>>question, then you need to learn more about what you are doing.
>> I wouldn't agree.
>> I tried using the same command I used when I did this in PHP.
>> That command was: mt_srand(date("w"))
>> It was a PHP command that seeds the MySQL random function,
>> according to the folks on the PHP newsgroup.
>It seems that they lied to you. Did you actually try that ?
>> I'm trying to figure out what the Python equivalent of that
>Python equivalent of that is random.seed(x), if PHP docs are to be believed.
>> Now do you see?
>What you acutally want is "select *,rand(3) as rand from table
>order by rand" or something like that. That 3 is the seed in there.
Yes, I actually tried that and it worked.
Things got much more random after I started using it.
More information about the Python-list