3 ms·
Yeah, I was making a Nixie tube clock with an STM32 and I was debating what I should use for my RNG... I was trying to write a decent implementation for a LFSR
by hatsunearu 6y ago
Yeah, I was making a Nixie tube clock with an STM32 and I was debating what I should use for my RNG...
I was trying to write a decent implementation for a LFSR PRNG and my friend was like fuck that, STM32 has a HW multiplier, just use an LCG and I wrote one from memory with like 2 lines. Just needed to grab the magic constants from wikipedia... (which I needed to anyway if I wanted to use an LFSR)
Strongly recommended, if you don't care about quality, LCG is simply unbeatable in terms of quick n dirtiness
- MengerSponge 6y agoFun little bit of computer history: the Atari game "River Raid" (available on some flashback consoles) uses "randomly" generated landscapes and obstacles, but it's exactly the same every time you play it. It uses the same seed on its LCG when you start the game, so everything else is deterministic. As far as I know it's the first procedurally generated video game.
- RodgerTheGreat 6y ago"Pitfall" for the Atari 2600 uses the same approach for laying out obstacles, with a carefully tuned seed that produces a winnable game world with reasonable difficulty progression. Another 2600 game, "Entombed", has seen recent enthusiasm for a novel automata which generates aesthetically pleasing and mostly-solvable mazes with a minimum of working memory.
- joelwilliamson 6y agoRogue is two years older than River Raid and also used procedural generation.
- duskwuff 6y agoWhich STM32 part? Some of them have a hardware RNG.
- hatsunearu 6y agoYeah, but an LCG is easier ;P And I used an STM32G031, which doesn't have one.