There are Random Numbers in Computers!

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024

ความคิดเห็น • 75

  • @rodolphov.santoro8829
    @rodolphov.santoro8829 4 หลายเดือนก่อน +6

    Randomness is CS is a really cool topic.
    I had to read a lot about it, when i worked with some physicists on oil particle simulations.
    They really needed it to be statistically random, for the simulation to be accurate, since the method used a lot of heuristics.
    I remember in the end we settled for some variation of a xorshift.

  • @hughjanes4883
    @hughjanes4883 4 หลายเดือนก่อน +26

    They say video games arnt random, but im about to name my next steam account after the ammount of time it takes for a ceisum atom to decay. Checkmate

  • @sekki2554
    @sekki2554 4 หลายเดือนก่อน +47

    Nobody says, that you can't generate a unique number. What we're saying is, that you can't generate a random number from nothing. You need a seed in computers. But it doesn't matter, because if you need actual security, you can always point a camera at a tree and use the pixeldata. It's just as effective as the wall of entropy (cloudflare). For games (Singleplayer & Multiplayer) currentTime is completely sufficient. Or even CPU usage spikes, what ever comes into your mind
    Still a good video, i enjoyed it

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน +8

      Hm yes but many peoople actually don't understand this properly or just dont know. I usually hear people saying just that computers can't generate random numbers and no one tells you that they can so that's why I made the video

    • @Miss_Skooter
      @Miss_Skooter 4 หลายเดือนก่อน +7

      @@lowlevelgamedev9330 The title is misleading though, I understand it the way Sekki explained and was expecting you'd somehow argue against that. Was kinda waiting for you to "get to it" the whole video until I realized you're not going to lol

    • @Miss_Skooter
      @Miss_Skooter 4 หลายเดือนก่อน +2

      It was fun to watch though, I should say xD

    • @sekki2554
      @sekki2554 4 หลายเดือนก่อน +1

      @@lowlevelgamedev9330 You're speaking of a pseudo random number, right? I don't remember that you spoke about actually generating real random numbers with a computer

    • @wjrasmussen666
      @wjrasmussen666 4 หลายเดือนก่อน

      @@lowlevelgamedev9330 Not most people I know. Even the non-technical types.

  • @catatrophicalist
    @catatrophicalist 4 หลายเดือนก่อน +11

    if (rand() == notRandom) {
    randomIt();
    }

    • @MercurySteel
      @MercurySteel 4 หลายเดือนก่อน +2

      rand() != Random

  • @alexandratsankova5825
    @alexandratsankova5825 4 หลายเดือนก่อน +5

    I remember i once made a random number generator which used an intentional race condition between a thread which sets a variable to time%2 and a thread which sets a variable to time%2==0
    I think i remember getting a pretty good distribution when constructing bytes out of random bits generated this way

  • @FireDragon91245
    @FireDragon91245 4 หลายเดือนก่อน +9

    Other idea a Kernel Level Programm that exposes an API that just hashes the RAM,
    Each computer is diferent, computers are as diferent or more diferent then humans
    and no human being or quantum computer could ever predict the state of RAM
    Programms, Virtual Addresses, Boot Order, Drivers, Ethernet Buffers, and 1000000000... more Each boot is guaranteed to be diferent RAM
    even if something in the internet changes like a IP a programm reaches for and the rest is asumed to be 100% the same RAM would be diferent

    • @JemEklery
      @JemEklery 4 หลายเดือนก่อน

      Actually, no.
      Just start two virtual machines with the same image, same inputs, same time, same CPU cycle count, etc. And you get two identical RAM data. Of course, this is only theoretical, but it is not *random*. Still deterministic, but very, very obfuscated.

  • @franklinnash
    @franklinnash 4 หลายเดือนก่อน +4

    Is it not true that with a small number of iterations random number generators can appear random, but given enough iterations patterns start to appear?

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน

      yes totally true, I show that in the vid later

  • @josephc-mg2tk
    @josephc-mg2tk 4 หลายเดือนก่อน +4

    Random = rand() * time(0) *pointer_sum_of_digit()#no im not putting a semicolon.....;

  • @KeinNiemand
    @KeinNiemand 10 วันที่ผ่านมา

    Even if there a truley random component in our decision that still doesn't allow for free will, randomness is by definition random, so you making a decition based on a quantum random coin flip in your brain doesn't really make it free will.

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  10 วันที่ผ่านมา

      hm, interesting point, than I guess by this definition we can say that there can't be free will?

  • @eennou
    @eennou 4 หลายเดือนก่อน +1

    I think we can (at kernel mode) read memory at random(based on seed or something) address * random number % another random number

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน +2

      yes but that won't have a good distribution, usually most junk ram has either 0 or paterns, you can try to read junk memory at random and you will see the word microsoft leftover there very often

  • @dominickreba3052
    @dominickreba3052 24 วันที่ผ่านมา

    can you just... use multiple less-effective random number generators with the mathematically perfect version to get a RNG that is unpredictable yet extremely perceptually versatile?
    Like have a switch statement with a bunch of values, and have the first X bits of the initial mathematically perfect version hook up to switch cases that then return their own RNG function's value :o
    ...it'd certainly be slower, but if you REALLY REEEEALLY need a random value it could work

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  23 วันที่ผ่านมา +1

      nope, not for cryptographical reasons. Combining multiple PRNGs can actually get a worse result mathematically. So its a little more difficult

    • @dominickreba3052
      @dominickreba3052 23 วันที่ผ่านมา

      @@lowlevelgamedev9330 damn, I never would've expected that. Thanks for the fast reply!

  • @InfiniteCoder01
    @InfiniteCoder01 4 หลายเดือนก่อน +2

    2:01 how accurate you described my regex-snake game)

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน

      bro you made snake in regex? 💀

    • @InfiniteCoder01
      @InfiniteCoder01 4 หลายเดือนก่อน

      @@lowlevelgamedev9330 yes, do you want to see it?)

    • @InfiniteCoder01
      @InfiniteCoder01 4 หลายเดือนก่อน

      ​@@lowlevelgamedev9330 Have I replied before?

    • @InfiniteCoder02
      @InfiniteCoder02 4 หลายเดือนก่อน

      @@lowlevelgamedev9330 Have I replied before?

    • @InfiniteCoder01
      @InfiniteCoder01 4 หลายเดือนก่อน

      I give up

  • @theunrealtarik
    @theunrealtarik 4 หลายเดือนก่อน +3

    this comment is not random

  • @oglothenerd
    @oglothenerd 25 วันที่ผ่านมา +1

    Couldn't you use a race condition to generate truly random numbers?

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  25 วันที่ผ่านมา +1

      yes, tho it will be probably biased. And that is not good for cryptographic stuff. It will also probably take a lot of MS to compute a 64 bit number in this way

    • @oglothenerd
      @oglothenerd 25 วันที่ผ่านมา +1

      @@lowlevelgamedev9330 True...

  • @paddleman3131
    @paddleman3131 4 หลายเดือนก่อน

    i did a leaf tree to see how random a computer is and i can definitely say it is random. there was no trend.

  • @thememermonkey
    @thememermonkey 4 หลายเดือนก่อน

    Would it be possible to get a random number by flipping a psudo randomly picked bit that is inside of a random number's bytes?

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน

      well I don't really understand the question so I do my best to explain, so there are pseudo random number generators that work by shifting and flipping bits, you have to keep in mind that just flipping a bit will have a bad distribution. And if you start from a true random number and you change it it's still true random, but if you just flip bits every number the sequence won't necessarily be very well distributed

  • @robopigs6877
    @robopigs6877 4 หลายเดือนก่อน +3

    Why not use framerate for the seed for randomness?

    • @costelinha1867
      @costelinha1867 4 หลายเดือนก่อน

      I'm not sure if it's a good idea to have your random seed tied to something like framerate...

    • @SoDamnMetal
      @SoDamnMetal 4 หลายเดือนก่อน +3

      You would let your game run arbitrarily at whatever frame rate the users hardware can handle? 💀

    • @MercurySteel
      @MercurySteel 4 หลายเดือนก่อน +1

      ​@@SoDamnMetalThat's actually a very interesting concept. A game that goes easy on people who use older devices.

    • @robopigs6877
      @robopigs6877 4 หลายเดือนก่อน

      Btw what i meant is using fps instead of time(NULL)

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน

      genius idea 😂

  • @Felix-att
    @Felix-att 4 หลายเดือนก่อน +1

    🎉🎉🎉

  • @slugintub
    @slugintub 4 หลายเดือนก่อน

    hey! could you please make a quick tutorial for your 3d graphics engine, gl3d?

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน

      I should do that, but it will take some time so if you want to use it tag me on my discord and I'll explain you how it works 💪💪

  • @noilfaund
    @noilfaund 4 หลายเดือนก่อน +1

    This video's not all bad, but the premise is incorrect. Effective randomness is achievable, but effective randomness is not true randomness. True randomness DOES NOT exist in computers. Do some people misinterpret this fact and give up too soon on achieving effective randomness? Perhaps. But you are making the conversation muddier and worse, rather than clearer and better. Also, I know this video is more likely to be cIickbait than truly made in error, and if so I'm giving you exactly what you want by responding. But teaching these things accurately is important, so I'm willing to take that risk.

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน

      and that's why I made the video to show that true randomness exists in computers, I think that movement from electrons is true random

    • @noilfaund
      @noilfaund หลายเดือนก่อน

      @@lowlevelgamedev9330 It's like you either didn't read, or didn't comprehend my comment. If you haven't yet, try using Google Translate to read it in your native language.

    • @mk72v2oq
      @mk72v2oq หลายเดือนก่อน

      x86 RDRAND instruction produces true randomness.

  • @romaromashka4431
    @romaromashka4431 4 หลายเดือนก่อน

    This video is exactly what I thought it would be before clicking. Surface knowledge and misunderstanding.
    1. Rng is fair if it has uniform distribution, funny how this basic theory part is not even mentioned, and that alone renders useless all your real data approaches(imagine all die rolls being rigged)
    2. Determinism is an important feature, because it allows you to reproduce simulation, and this 'debuggable' feature should be exploited by engeniers. (that's why they use prng in scientific simulations)
    3. prng's only disadvantage is that it can be cracked(cause you have repeating pattern), so it cannot be used in fields like cryptography. But in every other application, determinism, speed and simplicity always outweigh and for games prng is more than adequate solution

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  4 หลายเดือนก่อน

      what? I literally talk about 2 and 3 and where is your misundertanding at?

  • @Cyber_Gas
    @Cyber_Gas 4 หลายเดือนก่อน

    Hello there the tittle is very accurate🤝🏿

  • @Paultimate7
    @Paultimate7 2 หลายเดือนก่อน

    Regardless of this video, there are only random numbers as far as your definition of "random" is. There is no truly random events in a reality governed by physics. So all you're doing is going another level of obscurity up. Thats all, but its "good enough" for most applications.

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  2 หลายเดือนก่อน

      as I said in the video, quantum mechanics is believed to be trully random because experimens and data show that.

  • @BaDitO2
    @BaDitO2 4 หลายเดือนก่อน

    nice

  • @Sweepy_Games
    @Sweepy_Games 4 หลายเดือนก่อน +1

    Randomness doesn't exist at all, not only in computers but irl too. Or does it?

    • @SoDamnMetal
      @SoDamnMetal 4 หลายเดือนก่อน

      No, the Universe is deterministic. Nothing is random, everything is calculable.

    • @MercurySteel
      @MercurySteel 4 หลายเดือนก่อน +4

      ​@@SoDamnMetal
      *Quantum physics entered the chat*

    • @SoDamnMetal
      @SoDamnMetal 4 หลายเดือนก่อน +2

      @@MercurySteel Just because we lack understanding and data about quantum physics, doesn't mean randomness is happening.

    • @SpazeOfficial
      @SpazeOfficial 4 หลายเดือนก่อน

      ​@@SoDamnMetalcan be either way

    • @mk72v2oq
      @mk72v2oq หลายเดือนก่อน

      @@SoDamnMetal no, it's proven to be fundamentally random. There are no hidden variables.

  • @Itz_Akashi.134
    @Itz_Akashi.134 4 หลายเดือนก่อน

    First 😆

  • @theunrealtarik
    @theunrealtarik 4 หลายเดือนก่อน +1

    нет ты плохой

    • @Hramzhuk
      @Hramzhuk 4 หลายเดือนก่อน

      почему