diff --git a/radio/blocks/sources/uniformrandom.lua b/radio/blocks/sources/uniformrandom.lua index e4a04363..4ab78c0f 100644 --- a/radio/blocks/sources/uniformrandom.lua +++ b/radio/blocks/sources/uniformrandom.lua @@ -85,16 +85,15 @@ function UniformRandomSource:get_rate() end function UniformRandomSource:initialize() - if self.seed then - math.randomseed(self.seed) - end - self.out = self.data_type.vector(self.chunk_size) end function UniformRandomSource:process() local out = self.out + -- Only run once in each block instance, as math.randomseed() returns nil + self.seed = self.seed and math.randomseed(self.seed) + for i=0, out.length-1 do out.data[i] = self.generator() end