The Problem with PRNGs

Pseudo-random number generators (PRNGs) are deterministic. Given the same seed, they'll produce the same sequence. For many applications, this is fine. But what if you want true randomness?

The Solution: Reddit as Entropy

I built an API that fetches the latest comments from Reddit, hashes them, and uses the hash as a seed. The idea is that the unpredictable nature of human comments provides true randomness.

Implementation

  • Fetch trending posts from multiple subreddits
  • Extract comment text and timestamps
  • Hash the combined data using SHA-256
  • Use the hash bytes to seed a cryptographically secure random number generator

Results

The API now serves random numbers to anyone who wants them. It's an interesting experiment in decentralized entropy!