MCPcopy Index your code
hub / github.com/python/cpython / _random_data

Function _random_data

Tools/scripts/sortperf.py:32–43  ·  view source on GitHub ↗
(size: int, rand: random.Random)

Source from the content-addressed store, hash-verified

30# ===============
31
32def _random_data(size: int, rand: random.Random) -> list[float]:
33 result = [rand.random() for _ in range(size)]
34 # Shuffle it a bit...
35 for i in range(10):
36 i = rand.randrange(size)
37 temp = result[:i]
38 del result[:i]
39 temp.reverse()
40 result.extend(temp)
41 del temp
42 assert len(result) == size
43 return result
44
45
46def list_sort(size: int, rand: random.Random) -> list[float]:

Callers 2

list_sortFunction · 0.85
list_sort_ascendingFunction · 0.85

Calls 4

randrangeMethod · 0.80
randomMethod · 0.45
reverseMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…