MCPcopy Create free account
hub / github.com/google-research/language / uniform_sample

Function uniform_sample

language/casper/utils/sample_utils.py:20–24  ·  view source on GitHub ↗

Samples k items using uniform sampling without replacement.

(pool: Sequence[Any], max_num_items: int)

Source from the content-addressed store, hash-verified

18
19
20def uniform_sample(pool: Sequence[Any], max_num_items: int) -> Sequence[Any]:
21 """Samples k items using uniform sampling without replacement."""
22 pool = list(pool)
23 random.shuffle(pool)
24 return pool[:max_num_items]
25
26
27def geometric_sample(pool: Sequence[Any], max_num_items: int,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…