There are Random Numbers in Computers!

Поділитися
Вставка
  • Опубліковано 4 чер 2024
  • In this video, I want to show why random numbers actually do exist in computers.
    #programming
    Join my Discord:
    / discord
    Wishlist Midnight Arrow:
    store.steampowered.com/app/23...
    Join this channel if you want to support me 😻:
    / @lowlevelgamedev9330
    Music:
    Frozen Sunrise - Firefly in a Fairytale Backwards
    Evan King - Everything is Okay
    Evan King - Spicy Boom
    / contextsensitive
    contextsensitive.bandcamp.com/

КОМЕНТАРІ • 60

  • @sekki2554
    @sekki2554 Місяць тому +42

    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  Місяць тому +7

      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 Місяць тому +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 Місяць тому +2

      It was fun to watch though, I should say xD

    • @sekki2554
      @sekki2554 Місяць тому +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 Місяць тому

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

  • @hughjanes4883
    @hughjanes4883 Місяць тому +24

    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

  • @rodolphov.santoro8829
    @rodolphov.santoro8829 Місяць тому +3

    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.

  • @alexandratsankova5825
    @alexandratsankova5825 Місяць тому +4

    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 Місяць тому +7

    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 Місяць тому

      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 Місяць тому +3

    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?

  • @catatrophicalist
    @catatrophicalist Місяць тому +7

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

  • @josephc-mg2tk
    @josephc-mg2tk Місяць тому +3

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

  • @thememermonkey
    @thememermonkey 27 днів тому

    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  27 днів тому

      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

  • @slugintub
    @slugintub Місяць тому

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

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  Місяць тому

      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 💪💪

  • @eennou
    @eennou Місяць тому

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

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  Місяць тому +1

      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

  • @paddleman3131
    @paddleman3131 Місяць тому

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

  • @robopigs6877
    @robopigs6877 Місяць тому +2

    Why not use framerate for the seed for randomness?

    • @costelinha1867
      @costelinha1867 Місяць тому

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

    • @SoDamnMetal
      @SoDamnMetal Місяць тому +3

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

    • @MercurySteel
      @MercurySteel Місяць тому +1

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

    • @robopigs6877
      @robopigs6877 Місяць тому

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

    • @lowlevelgamedev9330
      @lowlevelgamedev9330  Місяць тому

      genius idea 😂

  • @theunrealtarik
    @theunrealtarik Місяць тому +3

    this comment is not random

  • @TeofilBejan-lg2rt
    @TeofilBejan-lg2rt 29 днів тому

    There are rand() and srand() funcționa în cmath library in c++

  • @Felix-att
    @Felix-att Місяць тому +1

    🎉🎉🎉

  • @InfiniteCoder01
    @InfiniteCoder01 Місяць тому +1

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

  • @Cyber_Gas
    @Cyber_Gas Місяць тому

    Hello there the tittle is very accurate🤝🏿

  • @BaDitO2
    @BaDitO2 Місяць тому

    nice

  • @noilfaund
    @noilfaund Місяць тому

    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  Місяць тому

      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

  • @Sweepy_Games
    @Sweepy_Games Місяць тому

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

    • @SoDamnMetal
      @SoDamnMetal Місяць тому

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

    • @MercurySteel
      @MercurySteel Місяць тому +4

      ​@@SoDamnMetal
      *Quantum physics entered the chat*

    • @SoDamnMetal
      @SoDamnMetal Місяць тому +2

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

    • @SpazeOfficial
      @SpazeOfficial Місяць тому

      ​@@SoDamnMetalcan be either way

  • @romaromashka4431
    @romaromashka4431 Місяць тому

    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  Місяць тому

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

  • @Itz_Akashi.134
    @Itz_Akashi.134 Місяць тому

    First 😆

  • @theunrealtarik
    @theunrealtarik Місяць тому +1

    нет ты плохой

    • @Hramzhuk
      @Hramzhuk Місяць тому

      почему