Samples up to current difficulty.
164791
def fetch(self):
    """"""
    length = np.random.randint(1, self._curr_length + 1)
    nesting = np.random.randint(1, self._curr_nesting + 1)
    return length, nesting
416976
function sample(iterable) {
  let index = lodash.random(0, iterable.size - 1)
  return iterable.get(index)
}
975334
def samples(self, nsamples, rstate=None):
        

        if rstate is None:
            rstate = np.random

        xs = np.array([self.sample(rstate=rstate) for i in range(nsamples)])

        return xs
835894
def sample(self, nsamples=100, seed=None):
        
        if nsamples < 1:
            raise ValueError("Number of samples must be larger than 0, got '%g'" % nsamples)

        if seed is None:
            seed = random.randint(0, 2 ** 32)

        if self.mode == 'spark':
            result = asarray(self.values.tordd().values().takeSample(False, nsamples, seed))

        else:
            inds = [int(k) for k in random.rand(nsamples) * self.shape[0]]
            result = asarray([self.values[i] for i in inds])

        return self._constructor(result)
121007
def sample(self, x0, nsteps, nskip=1):
        """
        x = np.zeros(shape=(nsteps + 1,))
        x[0] = x0
        for t in range(nsteps):
            q = x[t]
            for s in range(nskip):
                q = self.step(q)
            x[t + 1] = q
        return x
1314541
def lifetimes_samples(self):
         """
        res = np.empty((self.nsamples, self.nstates), dtype=config.dtype)
        for i in range(self.nsamples):
            res[i, :] = self._sampled_hmms[i].lifetimes
        return res
59357
def check_fam_for_samples(required_samples, source, gold):
    """"""
    # Checking the source panel
    source_samples = set()
    with open(source, 'r') as input_file:
        for line in input_file:
            sample = tuple(line.rstrip("\r\n").split(" ")[:2])
            if sample in required_samples:
                source_samples.add(sample)

    # Checking the gold standard
    gold_samples = set()
    with open(gold, 'r') as input_file:
        for line in input_file:
            sample = tuple(line.rstrip("\r\n").split(" ")[:2])
            if sample in required_samples:
                gold_samples.add(sample)

    # Checking if we got everything
    logger.info("  - Found {} samples in source panel".format(
        len(source_samples),
    ))
    logger.info("  - Found {} samples in gold standard".format(
        len(gold_samples),
    ))

    if len(required_samples - (source_samples | gold_samples)) != 0:
        return False
    else:
        return True
333477
public function samples()
    {
        if ($this->p()->l10n() === false) {
            $origLang = $this->lang();
            $locales  = $this->translator()->availableLocales();
            $sampleId = $this->sampleId();
            foreach ($locales as $langCode) {
                $this->setSampleId($sampleId.'_'.$langCode);
                $this->setLang($langCode);

                yield $this;
            }
            $this->setSampleId($sampleId);
            $this->setLang($origLang);
        } else {
            yield $this;
        }
    }
1161865
def sample( s )
      @sum += s
      @sumsq += s * s
      if @num == 0
        @min = @max = s
      else
        @min = s if @min > s
        @max = s if @max < s
      end
      @num += 1
      @last = s
    end
80043
def sampleset(self, factor_bbox=10.0, num=1000):
        
        w1, w2 = self.bounding_box(factor=factor_bbox)

        if self._n_models == 1:
            w = np.logspace(w1, w2, num)
        else:
            w = list(map(partial(np.logspace, num=num), w1, w2))

        return np.asarray(w)
346805
def from_sample(sample):
    
    upload_config = sample.get("upload")
    if upload_config:
        approach = _approaches[upload_config.get("method", "filesystem")]
        for finfo in _get_files(sample):
            approach.update_file(finfo, sample, upload_config)
    return [[sample]]
1141515
def sample(self):
        '''
        '''
        sample = []
        iterator = iter(self.__sample_extended_rows)
        iterator = self.__apply_processors(iterator)
        for row_number, headers, row in iterator:
            sample.append(row)
        return sample
1060229
def sample_histograms(fig, input_sample, problem, param_dict):
    '''

    '''
    num_vars = problem['num_vars']
    names = problem['names']

    framing = 101 + (num_vars * 10)

    # Find number of levels
    num_levels = len(set(input_sample[:, 1]))

    out = []

    for variable in range(num_vars):
        ax = fig.add_subplot(framing + variable)
        out.append(ax.hist(input_sample[:, variable],
                           bins=num_levels,
                           normed=False,
                           label=None,
                           **param_dict))

        ax.set_title('%s' % (names[variable]))
        ax.tick_params(axis='x',  # changes apply to the x-axis
                       which='both',  # both major and minor ticks are affected
                       bottom='off',  # ticks along the bottom edge are off
                       top='off',  # ticks along the top edge are off
                       labelbottom='off')  # labels along the bottom edge off)
        if variable > 0:
            ax.tick_params(axis='y',  # changes apply to the y-axis
                           which='both',  # both major and minor ticks affected
                           labelleft='off')  # labels along the left edge off)

    return out
155809
def _sampleFromEdges(self):
    
    dimensionsToChooseFrom = range(self.dimension)
    random.shuffle(dimensionsToChooseFrom)
    dim1, dim2 = dimensionsToChooseFrom[0], dimensionsToChooseFrom[1]
    coordinates = [random.uniform(-1, 1) * dim / 2. for dim in self.dimensions]
    coordinates[dim1] = self.dimensions[dim1] / 2. * random.choice([-1, 1])
    coordinates[dim2] = self.dimensions[dim2] / 2. * random.choice([-1, 1])
    return coordinates
525243
def num_samples(self):
        
        with self.container.open_if_needed(mode='r') as cnt:
            return cnt.get(self.key)[0].shape[0]
78380
def sample(self, hash, limit=None, offset=None):
        ''''''

        uri = self._uris['sample'].format(hash)
        params = {'limit': limit, 'offset': offset}

        return self.get_parse(uri, params)
1050825
def SampleStart(self):
    """"""
    self._start_cpu_time = time.clock()
    self.start_sample_time = time.time()
    self.total_cpu_time = 0