def _choose_random_tests(tests, ratio, seed):
    rnd = random.Random()
    rnd.seed(seed)
    if isinstance(tests, unittest.TestSuite):
        tests = _flatten_suite(tests)
    tests = rnd.sample(tests, int(len(tests) * ratio))
    tests = sorted(tests, key=lambda case: case.id())
    return unittest.TestSuite(tests)


# The reference leak detection code is liberally taken and adapted from
# Python's own Lib/test/regrtest.py.
The parent of the record.
dataset/ETHPy150Open numba/numba/numba/testing/main.py/_choose_random_tests--crossover with--dataset/ETHPy150Open lektor/lektor/lektor/db.py/Page.parent