[UT][XPU] fix test_parallel_sampling due to global random state (#42388)

Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
This commit is contained in:
liuzhenwei
2026-05-12 18:03:23 +08:00
committed by GitHub
parent e1c8776e90
commit 07a40ede19
+2 -1
View File
@@ -79,10 +79,11 @@ def _get_test_sampling_params(
structured_outputs: bool = False,
) -> tuple[list[SamplingParams], list[int]]:
"""Generate random sampling params for a batch."""
rng = random.Random(seed)
def get_mostly_n_gt1() -> int:
r"""Mostly n \in [2,20], ~1/3 n=1"""
x = random.randint(0, 28)
x = rng.randint(0, 28)
if x < 10:
return 1
else: