Return the random records of centain kind.
764062
def query_random(**kwargs):
        '''
        
        '''

        if 'limit' in kwargs:
            limit = kwargs['limit']
        elif 'num' in kwargs:
            limit = kwargs['num']
        else:
            limit = 10

        kind = kwargs.get('kind', None)

        if kind:
            rand_recs = TabPost.select().where(
                (TabPost.kind == kind) &
                (TabPost.valid == 1)
            ).order_by(
                peewee.fn.Random()
            ).limit(limit)
        else:
            rand_recs = TabPost.select().where(
                TabPost.valid == 1
            ).order_by(
                peewee.fn.Random()
            ).limit(limit)
        return rand_recs
866582
def get_random(self):
        
        Statement = self.get_model('statement')

        statement = Statement.objects.order_by('?').first()

        if statement is None:
            raise self.EmptyDatabaseException()

        return statement
336796
def random_get_instance() -> tcod.random.Random:
    
    return tcod.random.Random._new_from_cdata(
        ffi.cast("mersenne_data_t*", lib.TCOD_random_get_instance())
    )
37372
def rand(x_bounds, x_types):
    '''
    
    '''
    outputs = []

    for i, _ in enumerate(x_bounds):
        if x_types[i] == "discrete_int":
            temp = x_bounds[i][random.randint(0, len(x_bounds[i]) - 1)]
            outputs.append(temp)
        elif x_types[i] == "range_int":
            temp = random.randint(x_bounds[i][0], x_bounds[i][1])
            outputs.append(temp)
        elif x_types[i] == "range_continuous":
            temp = random.uniform(x_bounds[i][0], x_bounds[i][1])
            outputs.append(temp)
        else:
            return None

    return outputs
537855
def generator(self, random, args):
        """"""
        if self.duplicates:
            max_count = [self.capacity // item[0] for item in self.items]
            return [random.randint(0, m) for m in max_count]
        else:
            return [random.choice([0, 1]) for _ in range(len(self.items))]
1241522
def init_random(X, n_clusters, random_state):
    """"""
    logger.info("Initializing randomly")
    idx = sorted(draw_seed(random_state, 0, len(X), size=n_clusters))
    centers = X[idx].compute()
    return centers
413706
function() {
    var block = this.rng.random() * this.discreteValues << 0
    return pad( block.toString( this.base ), this.fill, this.blockSize )
  }
207704
def randomize_es(es_queryset):
    """"""
    return es_queryset.query(
        query.FunctionScore(
            functions=[function.RandomScore()]
        )
    ).sort("-_score")
614932
def _random_candidates(self, n=1000):
        """"""

        candidates = np.zeros((n, len(self.tunables)))
        for i, tunable in enumerate(self.tunables):
            param = tunable[1]
            lo, hi = param.range
            if param.is_integer:
                column = np.random.randint(lo, hi + 1, size=n)

            else:
                diff = hi - lo
                column = lo + diff * np.random.rand(n)

            candidates[:, i] = column

        return candidates
520953
def shapeRecords(self):
        """"""
        shapeRecords = []
        return [_ShapeRecord(shape=rec[0], record=rec[1]) \
                                for rec in zip(self.shapes(), self.records())]
929921
def _shuffle_tfrecord(path, random_gen):
  """"""
  # Read all records
  record_iter = tf.compat.v1.io.tf_record_iterator(path)
  all_records = [
      r for r in utils.tqdm(
          record_iter, desc="Reading...", unit=" examples", leave=False)
  ]
  # Shuffling in memory
  random_gen.shuffle(all_records)
  # Write all record back
  with tf.io.TFRecordWriter(path) as writer:
    for record in utils.tqdm(
        all_records, desc="Writing...", unit=" examples", leave=False):
      writer.write(record)
1109872
def random(cls):
        """"""
        axis = random_unit()
        angle = np.random.uniform(0,2*np.pi)
        invert = bool(np.random.randint(0,2))
        return Rotation.from_properties(angle, axis, invert)
1159874
private ArrayDBIDs initialSet(DBIDs sampleSet, int k, Random random) {
    return DBIDUtil.ensureArray(DBIDUtil.randomSample(sampleSet, k, random));
  }
1141384
def _random(self, key):
        """"""

        if hasattr(key, "encode"):
            key = key.encode('ascii')

        value = (zlib.crc32(key, self.seed) & MAX_VALUE)

        return value * INV_MAX_VALUE
857447
def list_records(self, domain, limit=None, offset=None):
        
        return domain.list_records(limit=limit, offset=offset)
130074
def get_adj_records(results, min_ratio=None, pval=0.05):
        """"""
        records = []
        for rec in results:
            # calculate some additional statistics
            # (over_under, is_ratio_different)
            rec.update_remaining_fldsdefprt(min_ratio=min_ratio)

            if pval is not None and rec.p_uncorrected >= pval:
                continue

            if rec.is_ratio_different:
                records.append(rec)
        return records
942048
def _rand_init(x_bounds, x_types, selection_num_starting_points):
    '''
    
    '''
    return [lib_data.rand(x_bounds, x_types) for i \
                    in range(0, selection_num_starting_points)]