23 Oct, 2026 One of my favorite xkcd comics of all time is Random Number. The image depicts a C function that supposedly returns a random integer, but in reality always returns 4. I was reminded of this wonderful comic a few days ago, due to a security incident where people accidentally used the number 4 (among others) instead of a properly generated sequence of random bytes. Satire has a tendency to become reality, I guess. Since there is a clear demand among developers for the xkcd random number generator, I’m of the opinion that self-respecting languages should ship a built-in implementation. I’m here today to lead by example, as I unveil the glorious @xkcdRandom builtin for the Zig language. Can you guess what it does? Indeed, it…
The glorious @xkcdRandom Zig builtin
Advertisement