<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def random(percent, fields=None, count=0):
 """Provides a sampling strategy that picks a semi-random set of rows. Args: percent: the percentage of the resulting hashes to select. fields: an optional list of field names to retrieve. count: maximum number of rows to limit the sampled results to (default 5). Returns: A sampling function that can be applied to get some random rows. In order for this to provide a good random sample percent should be chosen to be ~count/#rows where #rows is the number of rows in the object (query, view or table) being sampled. The rows will be returned in order; i.e. the order itself is not randomized. """

    def _random_sampling(sql):
      projection = Sampling._create_projection(fields)
      sql = 'SELECT %s FROM (%s) WHERE rand() < %f' % (projection, sql, (float(percent) / 100.0))
      if count != 0:
        sql = '%s LIMIT %d' % (sql, count)
      return sql
    return _random_sampling