def get_random(self):
        """
        Returns a random statement from the database
        """
        from random import randint

        count = self.count()

        if count < 1:
            raise self.EmptyDatabaseException()

        random_integer = randint(0, count - 1)

        statements = self.statements.find().limit(1).skip(random_integer)

        return self.mongo_to_object(list(statements)[0])
def get_random ( self ) : from random import randint count = self . count ( ) if count < 1 : raise self . EmptyDatabaseException ( ) random_integer = randint ( 0 , count - 1 ) statements = self . statements . find ( ) . limit ( 1 ) . skip ( random_integer ) return self . mongo_to_object ( list ( statements ) [ 0 ] )
Returns a random statement from the database