Used an LFSR (linear feedback shift register) again today. So sad how few people know about LFSRs nowadays
Maybe I'll do a short video on em 🤔
Used an LFSR (linear feedback shift register) again today. So sad how few people know about LFSRs nowadays
Maybe I'll do a short video on em 🤔
@eniko David X Newton did a good video on them in explaining how Transport Tycoon works. You might want to see it for some ideas!
https://youtu.be/bHRhPj0CRXI?si=c9FA3iYp1J6HZ0pt
@adaliabooks @eniko so the nice thing about LFSRs has historically been that you can have nice long ones and not need that lookup table, which was very handy back when ram was measured in kilobytes or a few megabytes.
Now you totally could just make the array... But it may still be slower. RAM isn't super fast, and the math for LFSR's is super simple
Thinking about this, is there a reason you wouldn't just run the loop once, save the order in an array and iterate over that?
Are the bit operations faster than retrieving something from an array would be?
That is a very handy trick to know.
Presumably you could increase the randomness by using a different, randomly chosen (from the set of numbers that work for the given size) feedback number for each overall loop? Or even just start on something other than 1? (unless starting on 1 is necessary?)
It's also the best explanation of the bit operators I've seen too, I can never get the hang of those.
076萌SNS is a social network, courtesy of 076. It runs on GNU social, version 2.0.2-beta0, available under the GNU Affero General Public License.
All 076萌SNS content and data are available under the Creative Commons Attribution 3.0 license.