Improved seeding of color rng in show command
authorClifford Wolf <clifford@clifford.at>
Fri, 18 Jul 2014 14:44:45 +0000 (16:44 +0200)
committerClifford Wolf <clifford@clifford.at>
Fri, 18 Jul 2014 14:44:45 +0000 (16:44 +0200)
passes/cmds/show.cc

index 92fc5bd55cea48cdc89849c5b54e2bf9f1c03c05..eab42e6ffde768b3793a7e1b3f3a5e7fb4e6fc16 100644 (file)
@@ -54,7 +54,7 @@ struct ShowWorker
        const std::vector<std::pair<std::string, RTLIL::Selection>> &color_selections;
        const std::vector<std::pair<std::string, RTLIL::Selection>> &label_selections;
 
-       uint32_t xorshift32(uint32_t x) {
+       static uint32_t xorshift32(uint32_t x) {
                x ^= x << 13;
                x ^= x >> 17;
                x ^= x << 5;
@@ -655,6 +655,8 @@ struct ShowPass : public Pass {
                        }
                        if (arg == "-colors" && argidx+1 < args.size()) {
                                colorSeed = atoi(args[++argidx].c_str());
+                               for (int i = 0; i < 100; i++)
+                                       colorSeed = ShowWorker::xorshift32(colorSeed);
                                continue;
                        }
                        if (arg == "-format" && argidx+1 < args.size()) {