Seeding the rand() Generator

Carl Banks pavlovevidence at gmail.com
Sun Aug 2 20:00:40 EDT 2009


On Aug 2, 2:18 pm, Fred Atkinson <fatkin... at mishmash.com> wrote:
> On Sun, 02 Aug 2009 08:53:50 -0700, Scott David Daniels
>
> <Scott.Dani... at Acm.Org> wrote:
> >Fred Atkinson wrote:
> >>        How does one seed the rand() generator when retrieving random
> >> recordings in MySQL?  
>
> >It is not entirely clear what you are asking.  If you are talking about
> >MySQL's random number generator, you are talking in the wrong newsgroup.
> >If you are talking about Python's, does this work?
> >     import random
> >     random.seed(123542552)
> >I'm not quite sure how you came to believe that Python controls MySQL,
> >as opposed to using its services.
>
> >--Scott David Daniels
> >Scott.Dani... at Acm.Org
>
>         I am coding in Python.  
>
>         I am accessing a MySQL database.  
>
>         I have a string to instruct the MySQL database to use the
> 'rand()' function to randomly choose one of the records in the
> database.  
>
>         I know how to seed it in PHP.  Does anyone know how to see it
> from with Python?  

It sounds like you are using MySQL's rand() function, which means that
whatever SQL command you used to seed it in PHP is the same command
you would use to seed it in Python.

You'll have to give us more information if you want a better answer
than that.


Carl Banks



More information about the Python-list mailing list