Seeding the rand() Generator

Fred Atkinson fatkinson at mishmash.com
Mon Aug 3 23:12:49 EDT 2009


On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks
<pavlovevidence at gmail.com> wrote:

	I appreciate the response.  

	I am executing a statement to retrieve one record at random.  

	An example would be: SELECT first, second, third, fourth,
fifth, sixth from sometable order by rand() limit 1

	It would be contained as: stmt = "SELECT first, second, third,
fourth, fifth, sixth from sometable order by rand() limit 1"

	Then I would execute it with the command: cursor.execute(stmt)

	How would I correctly seed the random generator in the MySQL
statement from within Python?  

	Regards, 



						Fred 



More information about the Python-list mailing list