scannable: fix RangeScan randomize seeding

This commit is contained in:
Chris Ballance 2017-03-31 09:41:53 +01:00 committed by Sébastien Bourdeauducq
parent 07c71bf020
commit bdf1ca25c6
2 changed files with 3 additions and 3 deletions

View File

@ -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:

View File

@ -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):