Thanks. It worked On Sun, 6 May 2018, 06:03 Massimo Di Pierro <[email protected]> wrote:
> you know you can do > > row = db(db.person.id>0).select(limitby=(0,1),orderby='<random>').first() > > > On Tuesday, 1 May 2018 17:06:26 UTC-5, pbreit wrote: >> >> I am very sorry, I need to be more careful with my replies. >> >> I wasn't sure if random needed to be imported but it looks like it does. >> So: >> >> import random >> >> rows = db(db.person.id>0).select() >> random_number = random.randrange(0, len(rows)) >> row = rows[random_number] >> return row >> >> >> -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/ynBOuIdufso/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

