aboutsummaryrefslogtreecommitdiff
path: root/scripts/benchmark.py
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2020-12-20 13:45:09 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-12-20 14:46:40 +0000
commitd1735ffb6da3b867ceda83fa89648a664a5dafd1 (patch)
tree30b5980940fc3ca5cd998eb13e25dd67d97cc8e1 /scripts/benchmark.py
parentrender: fix rounding error when calculating background color with alpha (diff)
generate-alt-random-writes: use python random, allow setting a seed
Using Python's own PRNG should make the code cleaner and allow for reproducible stimulus files if that is desired via setting --seed (at least for the same versions of the script, changing the kind and/or order of the random calls will of course impact the output in the future). I did the following substitutions: * rand.read(1)[0] % n and struct.unpack('@H', rand.read(2))[0] % n → random.randrange(n) * rand.read(1)[0] → random.randrange(256) * rand.read(n) → [random.randrange(256) for _ in range(n)] (better alternative would have been random.randbytes(n), but is only available for Python >= 3.9, switching to this in the future will impact output) * list[rand.read(1) % len(list)] → random.choice(list)
Diffstat (limited to 'scripts/benchmark.py')
0 files changed, 0 insertions, 0 deletions