Is uninitialized local variable the fastest random number generator?

As others have noted, this is Undefined Behavior (UB). In practice, it will (probably) actually (kind of) work. Reading from an uninitialized register on x86[-64] architectures will indeed produce garbage results, and probably won’t do anything bad (as opposed to e.g. Itanium, where registers can be flagged as invalid, so that reads propagate errors like … Read more