From bdf1ca25c670408f12d34b746bc3982ce113afe9 Mon Sep 17 00:00:00 2001 From: Chris Ballance Date: Fri, 31 Mar 2017 09:41:53 +0100 Subject: [PATCH] scannable: fix RangeScan randomize seeding --- artiq/gui/entries.py | 1 + artiq/language/scan.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/artiq/gui/entries.py b/artiq/gui/entries.py index ced7de645..c8ba8e3c3 100644 --- a/artiq/gui/entries.py +++ b/artiq/gui/entries.py @@ -361,6 +361,7 @@ class ScanEntry(LayoutWidget): state[ty]["stop"] = default["stop"] state[ty]["npoints"] = default["npoints"] state[ty]["randomize"] = default["randomize"] + state[ty]["seed"] = default["seed"] elif ty == "ExplicitScan": state[ty]["sequence"] = default["sequence"] else: diff --git a/artiq/language/scan.py b/artiq/language/scan.py index 37e3c0be1..8c38ce63c 100644 --- a/artiq/language/scan.py +++ b/artiq/language/scan.py @@ -78,9 +78,8 @@ class RangeScan(ScanObject): self.sequence = [i*dx + start for i in range(npoints)] if randomize: - if seed is not None: - random.seed(seed) - random.shuffle(self.sequence) + rng = random.Random(seed) + random.shuffle(self.sequence, rng.random) @portable def __iter__(self):