MCPcopy
hub / github.com/networkx/networkx / choice

Method choice

networkx/utils/misc.py:397–404  ·  view source on GitHub ↗
(self, seq)

Source from the content-addressed store, hash-verified

395 # NOTE: the numpy implementations of `choice` don't support strings, so
396 # this cannot be replaced with self._rng.choice
397 def choice(self, seq):
398 import numpy as np
399
400 if isinstance(self._rng, np.random.Generator):
401 idx = self._rng.integers(0, len(seq))
402 else:
403 idx = self._rng.randint(0, len(seq))
404 return seq[idx]
405
406 def gauss(self, mu, sigma):
407 return self._rng.normal(mu, sigma)

Callers 15

sampleMethod · 0.80
choose_pref_attachFunction · 0.80
relaxed_caveman_graphFunction · 0.80
_generate_communitiesFunction · 0.80
LFR_benchmark_graphFunction · 0.80
random_labeled_treeFunction · 0.80
gnm_random_graphFunction · 0.80
watts_strogatz_graphFunction · 0.80
_random_subsetFunction · 0.80

Calls 1

randintMethod · 0.80