39
submitted 10 months ago by mac@programming.dev to c/gamedev@programming.dev
top 10 comments
sorted by: hot top controversial new old
[-] SatanicNotMessianic@lemmy.ml 17 points 10 months ago

7 is the most random number, because when you ask someone to choose a random number between 1 and 10, most people choose 7.

Whenever you need a random number in your code, don’t use rand() or a similar function. Use 7. It’s faster, and it’s the choice of the people.

[-] Enkers@sh.itjust.works 12 points 10 months ago* (last edited 10 months ago)

This seems like you're introducing selection bias. Do you really want laypersons to influence your code? You should poll a representative sample of coders for a random number, and use the mode of that.

Here, I'll start you off: 7

[-] SatanicNotMessianic@lemmy.ml 3 points 10 months ago

I’m good with that. My current number of upvotes is the most random number, which I also find acceptable.

[-] sus@programming.dev 4 points 10 months ago

// guaranteed to be random

[-] Spzi@lemm.ee 2 points 10 months ago

That's a very long list of different techniques with examples, very cool!

Though I wonder, is there some connection to image processing, high dynamic range?

Or audio compression, the kind which brings out the kick in the mix, not the kind which saves disk space?

The similarity I see between all three fields is, they try to bring down extreme values, outliers, to level the field, while still retaining characteristics.

[-] fibojoly@sh.itjust.works 2 points 10 months ago

I'm guessing you're referring to the colors of noise?

[-] Spzi@lemm.ee 2 points 10 months ago

I didn't know about that [under this name], so thanks for bringing it up. But no, I meant something slightly different.

Colors of noise describes how to generate different distributions. What I meant was how to transform distributions.

Many of the examples in the article start with a random number distribution, and then transform it to reduce discrepancy.

This reminded me of audio/video signal processing. For example, one can take a picture and transform it to reduce discrepancy (so that neither very bright parts nor very dark parts overshoot). Or you can take an audio sample and transform it to reduce discrepancy in loudness.

So the idea was that maybe techniques of either field (RNG, audio, video) could be applied to both other fields.

[-] TheLongPrice@lemmy.one 1 points 10 months ago

This is cool! Is it your blog?

[-] mac@programming.dev 5 points 10 months ago* (last edited 10 months ago)

Nah not mine, just one I found and thought was pretty cool. Added the source to my rss reader and probably gonna post more from them in the future

[-] huntrss@feddit.de 1 points 10 months ago

I found this article also very interesting: https://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/

It focusses more or less on one sequence but provides use cases and in-depth knowledge

this post was submitted on 19 Jan 2024
39 points (97.6% liked)

Game Development

2814 readers
1 users here now

Welcome to the game development community! This is a place to talk about and post anything related to the field of game development.

Community Wiki

founded 1 year ago
MODERATORS