Тёмный

Why Random Numbers Aren't Random 

Tech With Tim
Подписаться 1,5 млн
Просмотров 76 тыс.
50% 1

Welcome to another video! In this video, I'm going to show why random numbers are not random. In most computer programming languages, random numbers are generated deterministically. Meaning you can guess what the random number will be and control it as well.
💻 AlgoExpert is the coding interview prep platform that I used to ace my Microsoft and Shopify interviews. Check it out and get a discount on the platform using the code "techwithtim" algoexpert.io/techwithtim
📄 Resources 📄
Python Random Module: docs.python.org/3/library/ran...
⭐️ Timestamps ⭐️
00:00 | Why Random Numbers Aren't Random
01:58 | Random Module Documentation
02:23 | Generating Random Numbers in Python
03:30 | Random Seeding
05:45 | Using System Time As A Seed
07:11 | How To Generate Truly Random Numbers
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
💰 Courses & Merch 💰
💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p...
👕 Merchandise: teespring.com/stores/tech-wit...
🔗 Social Medias 🔗
📸 Instagram: / tech_with_tim
📱 Twitter: / techwithtimm
⭐ Discord: / discord
📝 LinkedIn: / tim-ruscica-82631b179
🌎 Website: techwithtim.net
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim
🎬 My RU-vid Gear 🎬
🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
🕹 Tripod: amzn.to/3hpSprv
🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
☀️ Lights: amzn.to/2ApeiXr
⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
📢 Speaker (Beats Pill): amzn.to/2XYc5ef
🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih
💸 Donations 💸
💵 One-Time Donations: www.paypal.com/donate?hosted_...
💰 Patreon: / techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
⭐️ Tags ⭐️
- Tech With Tim
- Random Numbers
- Random Module
- System Time
- Truly Random Numbers
- Python
⭐️ Hashtags ⭐️
#TechWithTim #RandomNumbers

Опубликовано:

 

25 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 198   
@laurinneff4304
@laurinneff4304 2 года назад
Another example for real random numbers: Cloudflare (a company which handles a very large part of internet traffic) has a room full of lava lamps with cameras pointed at them, and they use the current state of the lava lamps for their random numbers
@eduardo.chaves
@eduardo.chaves 2 года назад
That's really cool LOL
@shourya9998
@shourya9998 2 года назад
I died when he said "I need to talk to you about something that's not random......Our sponsor algoexpert'
@8koi139
@8koi139 2 года назад
Smooth
@renderize69
@renderize69 2 года назад
Oh, I see you're dead now. Meet you in heaven.
@MrTaken-tl4bw
@MrTaken-tl4bw 2 года назад
Tim is genually the embodiment of a nice guy. Also his videos are so amazingly well done and easy to follow. Learnt flask from him and today I'm almost finishing my raspberry pi home server
@JLSXMK8
@JLSXMK8 2 года назад
Learnt Flask from his channel? Was it easy to use? What is it?
@electricimpulsetoprogramming
@electricimpulsetoprogramming 2 года назад
@@JLSXMK8 I prefer django.
@JLSXMK8
@JLSXMK8 2 года назад
@@electricimpulsetoprogramming Open-source Web framework; NICE!!! You a Linux geek?
@electricimpulsetoprogramming
@electricimpulsetoprogramming 2 года назад
@@JLSXMK8 Actually in just a normal person who prefers django because I'm already comfortable using it and the django's documentation is well done. And about my operational system I use ubuntu since I don't like windows but I don't want to lost the comfort of a easy to use operational system
@JLSXMK8
@JLSXMK8 2 года назад
@@electricimpulsetoprogramming You use Ubuntu? Well, perfect! Yeah, those Linux terminals and servers are a freaking godsend for programmers!
@addisumengistu4784
@addisumengistu4784 2 года назад
Random module in Python was a total mystery for me Thanks tim
@timhowitz9405
@timhowitz9405 2 года назад
In one of cloudflare's offices, they use a camera pointed at a wall of lava lamps for randomness
@Aradiv
@Aradiv 2 года назад
And you can go there and view them in person if you want to.
@TheDuerden
@TheDuerden 2 года назад
I just posted that too - was it a Tom Scott video? I feel like it probably was..
@timhowitz9405
@timhowitz9405 2 года назад
@@TheDuerden Yeah, it was, that's where I got it from
@shravanasati9631
@shravanasati9631 2 года назад
Damn
@protondev3428
@protondev3428 2 года назад
@Phoenix 𝙾𝚙𝚎𝚗 𝙼𝚢 PROFILE uuid is usally just an incremented number hashed
@jhonsuper7065
@jhonsuper7065 2 года назад
Tim your a great youtuber man, you literally just calmly explain everyone how something works. Your videos ALWAYS teach something new. Man lots of respect to you. ♥
@TechWithTim
@TechWithTim 2 года назад
I appreciate that!
@JK-cs3sq
@JK-cs3sq 2 года назад
Great video, Tim. Any chance you could discuss the sys module next time?
@rishilkadakia4779
@rishilkadakia4779 2 года назад
Wow, that's actually really cool. Great video as always! 👍
@jatingera924
@jatingera924 2 года назад
I am glad my mentor has already told me while learning python. Hat's off to you tim also 😄 and that time was chosen(if I remember properly) cauz unix system was introduced for the first time then. But some platforms use different timeline for doing this.
@tgpsonic4821
@tgpsonic4821 2 года назад
Really amazing video, this is gonna help me alot for an oral test I'm working on. Thank you for all that knowledge, there is alot I will talk about
@johnnyfrankenstein0123
@johnnyfrankenstein0123 2 года назад
Thank you! Always heard that random numbers aren't random but never bothered finding out until this popped up, very interesting video 👍
@MrLottoLife
@MrLottoLife Год назад
Your insights are GOLD.
@user-rx6xu6bs8c
@user-rx6xu6bs8c 2 года назад
"Why Random Numbers Aren't Random" RNGs based on quantium physics: ok
@LordKing13
@LordKing13 2 года назад
thank you bro! I allways wonder why we use time to get random numbers and this video help me a lot!
@fadamitanolatomiwas.miguel6626
@fadamitanolatomiwas.miguel6626 2 года назад
Thanks for the knowledge Tim
@saqibshafin
@saqibshafin 2 года назад
Thank you very much for the Radioactive Decay portion!!!
@yazidziregue7912
@yazidziregue7912 2 года назад
truly facinating, thanks for the content
@alokkumarsingh4641
@alokkumarsingh4641 Год назад
very informative thanks buddy
@dollarbill8959
@dollarbill8959 2 года назад
They're called pseudo random generators. In Data science as long as you get the correct distribution it doesn't matter. Plus, setting seeds is helpful as it allows others to reproduce results.
@nanajnananajna3124
@nanajnananajna3124 2 года назад
Question are uuid's generated by the "UUID" module in python also not really random or unique or they are?
@erfan_ops
@erfan_ops 2 года назад
Thank you that was a really good explanation
@tuhinbhowmick8424
@tuhinbhowmick8424 2 года назад
The last example was grt..❤️❤️❤️
@lakshyachopra_
@lakshyachopra_ 2 года назад
Next video suggestion: 1. Why python variables aren't containers but pointers? Or 2. How does for in loop works behind the scenes in python? Edit: what does range function produce (iterator or iterable) might also be a nice video idea.
@ncb4_69
@ncb4_69 2 года назад
Maybe iterable
@aryankathawale9269
@aryankathawale9269 2 года назад
try this code and you will get ur ans : a = list(range(0,100) print(a)
@aim2986
@aim2986 2 года назад
@@aryankathawale9269 that doesnt answer anything
@aryankathawale9269
@aryankathawale9269 2 года назад
@@aim2986 ok , teach a man to fish , I want him to try doing this himself and not just tell him how it actually works , i could just tell him but that will not help him in long run you see
@aim2986
@aim2986 2 года назад
​@@aryankathawale9269 your code simply converts a range object to a list then prints it. It doesnt directly show whether the range object is an iterable or an iterator. In order to tell this, he should have known the interface of the builtin list type constructor. Yeah, it is an easy guess even if you dont know, but this is not the only thing to guess. He asks "what does range function produce" so it's obvious that he isn't aware of the fact that range isn't a function. And when the number of guesses increase, it becomes a complicated problem which can't be solved by looking at a code printing a list. If you want to help him in the long run, you could at least put a few links from the official docs explaining these things.
@ashwinshetgaonkar6329
@ashwinshetgaonkar6329 2 года назад
very informative ,it cleared my doubt that randomness can't be programmed.
@apren9569
@apren9569 2 года назад
This video is 100% what i was looking for!
@calitts4708
@calitts4708 2 года назад
Some channels read our minds and post the exact video we were looking for
@parsanasiri1712
@parsanasiri1712 2 года назад
Same
@apren9569
@apren9569 2 года назад
@@calitts4708 exactly, but when it comes from Tim its definitely good info.
@SuadoCowboy
@SuadoCowboy 2 года назад
twt and codecamp always read my mind
@streetboss2371
@streetboss2371 2 года назад
that is amazing topic bro thankz for share with us in very simple method to understand ❤️❤️❤️
@mightye6669
@mightye6669 2 года назад
My go to programming RU-vidr
@raivisrasnacs1088
@raivisrasnacs1088 2 года назад
What keyboard are you using? it sounds quiet nice.
@akshatrastogi9063
@akshatrastogi9063 Год назад
Wow man! I always thought the same that if the computer program is generating the same random numbers for a given seed, then if we can figure out the underlying dynamics of the code, the random number is no longer random. Glad you clarified my intuition in this video. On that note, I feel that there is nothing in the world which is truly random in nature..we as a human being are governed by some chemistry in each cell in our body...I mean, if I sneeze here and the pressure generated from it may have 1e-100 % of influence in affecting the air flow in some other part of the world. If we can connect them through some mathematical model and have the capability of solving that model with some clestially powerful supercomputers, we can still predict the influence of my sneeze in influencing the air flow at some other place in the world.... :)
@kvelez
@kvelez Год назад
Great explanation.
@AhmadKhalidNasrat
@AhmadKhalidNasrat 2 года назад
Randomness in FPGA and other embedded devices which use cryptography is generated from various source, e.g noise, heat and other parameters as I remember in hardware security course I had.
@TheRexona1986
@TheRexona1986 2 года назад
Ty.. very nice explanation.
@danbrown6698
@danbrown6698 2 года назад
This video is useful and interesting!
@MinerKingX
@MinerKingX 2 года назад
that date he is talking about at around 6:20 is called the unix timestamp
@xrafter
@xrafter 2 года назад
UNIX EPOCH
@ano3000nymous
@ano3000nymous 2 года назад
Great knowledge 👍
@SatisfyingWhirlpools
@SatisfyingWhirlpools Год назад
I feel like unless you can predict random numbers you haven’t seen yet from the program, it’s doing it’s job perfectly.
@ShivekMaharaj
@ShivekMaharaj 2 года назад
Nice Video, Tim. 👌
@OpenSaned
@OpenSaned 2 года назад
When you get a algoexpert ad before a algoexpert sponsored video
@mrkaro7468
@mrkaro7468 2 года назад
Thanks, i always had this question that how true random numbers are generated.
@PvblivsAelivs
@PvblivsAelivs 2 года назад
Traditionally, in most programming languages, it is measured from midnight 1 Jan 1970 GMT.
@abdullahmohammed6115
@abdullahmohammed6115 2 года назад
very cool vid like always.
@markdillon9588
@markdillon9588 2 года назад
Very interesting 👍
@realmodpotato
@realmodpotato 2 года назад
very interesting but im more curious what ide this is where itll let you launch it on demand from the ide
@farzadmoradkhani
@farzadmoradkhani 2 года назад
It was awesome bro 😎
@OllsKershaw
@OllsKershaw 4 месяца назад
Is it possible to come up with a new set of numbers that are based on several numbers?
@RAIOXBOX
@RAIOXBOX 2 года назад
What if theres an engine that also does run the random seed as random aswell? Will it be truly random?
@ichoupettev4661
@ichoupettev4661 2 года назад
Very interesting
@PBalint817
@PBalint817 2 года назад
When tech youtubers are out of ideas: "Let's talk about randomness! That should do it!"
@amirhossein8329
@amirhossein8329 2 года назад
Perfect 👌
@TheDuerden
@TheDuerden 2 года назад
I saw a video awhile back about a company that used Lava Lamps to achieve 'random' by watching a wall of lava lamps and using a camera to pinpoint where the lava was across them all at any given point. Tom Scott probably made it, I am not sure about that, but seems like the kind of video he would make.
@soulninjadev
@soulninjadev 2 года назад
that company is called cloudflare
@ameermuthumama9258
@ameermuthumama9258 2 года назад
What a perfect time today only I learned about random ()
@kenet7877
@kenet7877 2 года назад
I love your shirt!
@falconsshorts5723
@falconsshorts5723 2 года назад
I LOVE YOUR VIDEOS
@danielegabellini
@danielegabellini 2 года назад
Cool video
@jreallyrean8208
@jreallyrean8208 2 года назад
So, does this imply why some accounts in any gacha or gambling games are lucky/unlucky?
@Plasmacore_V
@Plasmacore_V 2 года назад
Shouldn't you use the Secrets module if you want as close to random numbers as possible?
@mustafaxd6952
@mustafaxd6952 2 года назад
What You Learned WIll In This Video: - seed function of the random module - time function of the time module - how random module works
@alxt111
@alxt111 2 года назад
I have a question: You use a for loop to create a random number 10 times. But if you use the same seed, shouldn't you get the same number as a result for every loop iteration? or is the seed altered after one use?
@abdullahmohammed6115
@abdullahmohammed6115 2 года назад
Basically, every time you use random.randint(), it stores what postion on the sequence you are on. For example, if you call randint() 3 times, it knows that the next time you call it, you want the FOURTH number in the sequence. The seed doesn't just create one number. It creates a infinite sequence.
@nocodenoblunder6672
@nocodenoblunder6672 2 года назад
@@abdullahmohammed6115 the seed is not creating the sequence. The sequence is the same for all seeds only their starting points differ.
@nocodenoblunder6672
@nocodenoblunder6672 2 года назад
@@abdullahmohammed6115 I think you would get the same number every time if you called random.seed(1) inside the loop resetting the current position on the sequence.
@alxt111
@alxt111 2 года назад
@@nocodenoblunder6672 Nice, thank you very much
@abdullahmohammed6115
@abdullahmohammed6115 2 года назад
@@nocodenoblunder6672 Yes you are right. I just tested it
@ACodingWoof
@ACodingWoof 2 года назад
6:10 It's the Unix timestamp by the way.
@Keventor
@Keventor 2 года назад
Why does the captions say seat when it is seed?
@dovos8572
@dovos8572 2 года назад
you can use a quanten module to make random seeds too. the one and only true random thing in the universe
@TheIndian123
@TheIndian123 2 года назад
We have been tricked, we have been backstabbed and most probably... Bamboozled
@melissaleigh3013
@melissaleigh3013 2 года назад
Thanks can u post fresca again pls
@eyosiyas_js
@eyosiyas_js 2 года назад
Insane
@xijinping3716
@xijinping3716 2 года назад
I am very Happy today
@its_code
@its_code 2 года назад
WOW 😳😲 amazing 😍. Love 💕 from Pakistan.
@Pawlo370
@Pawlo370 11 месяцев назад
when i making print(randint(1, 6)) and if computer is loud the 1 is very common
@waliqadri
@waliqadri Год назад
I thought, it reads the CPU fan temperature, voltage and date time to generate random numbers
@Gameplayer55055
@Gameplayer55055 2 года назад
Actually random is something that is predictable, but it is super ultra hard to predict
@zerotwoisreal
@zerotwoisreal 2 года назад
how does it generate the numbers it chooses for each seed? there must be some way
@gaby8706
@gaby8706 2 года назад
maybe time
@8koi139
@8koi139 2 года назад
when Tim said seed I instantly thought of the seed used in ML to get always the same result as te tutorial... totally forgot about minecraft lol
@flleaf
@flleaf 2 года назад
6:13 i believe unix was made in the end of 1969 so it starts with that date
@fipium
@fipium 2 года назад
video idea: tutorial on how to generate TRULY random numbers in python
@rafasantos23
@rafasantos23 2 года назад
*Python has been lying to me 😞*
@abdullahbinjahed6900
@abdullahbinjahed6900 2 года назад
it's this way for everything ... there's no true randomness in nature
@davidjohnston4240
@davidjohnston4240 2 года назад
The term "truly random" is a bad term. It doesn't have a proper definition. The properties you want to claim or not claim are uniformity, deterministic, nondeterministic, cryptographically secure and entropic at some level. Python has the RdRand module that works the same way as the random library but provides nondeterministic cryptographically secure random numbers on X86 platforms that support the RdRand and RdSeed instructions.
@4_real_bruh
@4_real_bruh 2 года назад
Problem with randomness is that it doesn't really exist. The entire universe with all of its complex systems might seem to have a whole lot of randomness, but when you pop the hood you find patterns and algorithms. So the best we can do to create seemingly "random" values for secure algorithms is rely on other chaotic factors like interference and radioactive decay of certain atoms or use techniques such as continuous seeding. Keyword "entropy".
@goKoding
@goKoding 2 года назад
humm...good explanation...
@nitigyajoshi4658
@nitigyajoshi4658 2 года назад
nice
@dimibyk6666
@dimibyk6666 2 года назад
Now I just have to know the starting point of the numbers of the Powerball
@manishtanwar989
@manishtanwar989 Год назад
How to predict the result of card games in online games
@tech-learner4555
@tech-learner4555 10 месяцев назад
6:39 idhuku paruthi moota godown layae irukalaamae, You can simple ignore random.seed() know why you have to use it, pass time.time() and then performing the actual functionality again, Thalaiya suthi mooka thodringa broo Edit: yeah actually you said the same just after illustrating this..
@igydkygs00kwhi
@igydkygs00kwhi Месяц назад
Randomness is a philosophy. Nothing is truly random. 💯
@williamdinkel2304
@williamdinkel2304 2 года назад
Haven't watched the video but I assume the answer to the question boild down to explaining causality.
@olauplarichart4419
@olauplarichart4419 2 года назад
Please pygame tutorials
@stavros222
@stavros222 2 года назад
and i was wondering what seed in minecraft exactly does
@netharuM
@netharuM 2 года назад
1:09 you wanna be a software engineer at google
@harshas8399
@harshas8399 2 года назад
I don't why someone is disliking this video...
@rp7r54
@rp7r54 Год назад
What is your opinion of a man that has a Mathematical equation or formula to predict winning Mega Millions numbers and Powerball numbers?
@magos2610
@magos2610 2 года назад
Tim, you look like a friend of mine, lol)))
@TheMahavatarBabaji
@TheMahavatarBabaji Год назад
'radioactive decay' - this only seems 'random' because nobody is aware of the 'seed'.
@hritikgautam5878
@hritikgautam5878 2 года назад
Nice video
@adthn
@adthn 2 года назад
lol.. u didnt even watch it😂
@SachinYadav-eh7vg
@SachinYadav-eh7vg 2 года назад
@@adthn 😂😂😂😂😂
@trinhvannghiep647
@trinhvannghiep647 2 года назад
I thought he gonna show the random number formula, so I can calculate the rarity of hatching pets in games
@arkodasgupta0412
@arkodasgupta0412 2 года назад
what theme do u use in vs code?
@Craigipo
@Craigipo 11 месяцев назад
Random number generators produce strings of numbers that are void of sequences or patterns. 1,4,9,16,25,36,49. 2,3,5,7,11,13,17,19 2,4,6,8,10,12,14,16 Sequences like these will NEVER occur in Random number generator. The RNGs have been programmed to avoid these Sequences. Strings of numbers that statistically should occur are omitted.
@lanceang795
@lanceang795 2 года назад
Nice shirt
@venkyman4985
@venkyman4985 2 года назад
According to Schrodinger, all the numbers exist simultaneously until you measure it.
@deadchannel7637
@deadchannel7637 2 года назад
❤️❤️
@siddharthasarmah9266
@siddharthasarmah9266 2 года назад
That was an LTT level segway ngl
@birgirsnr4710
@birgirsnr4710 2 года назад
My brother said everything 3 sec before you how insane he has never coded in python WHAT ??
@monsieuralexandergulbu3678
@monsieuralexandergulbu3678 2 года назад
Random numbers are random But pseudo-random numbers that you can get in all of the programming languages are in fact pseudo-random
Далее
How to predict random numbers
17:22
Просмотров 139 тыс.
NMCS4ALL: Random number generators
20:10
Просмотров 69 тыс.
КОГДА БАТЕ ДАЛИ ОТПУСК😂#shorts
00:59
What Self-Taught Developers NEVER Learn
13:23
Просмотров 163 тыс.
Python 101: Learn the 5 Must-Know Concepts
20:00
Просмотров 1,1 млн
Almost All Random Numbers Are Actually Fake
19:38
Просмотров 509 тыс.
25 Terms All Programmers NEED To Know!
10:21
Просмотров 59 тыс.
Randomness is Random - Numberphile
13:31
Просмотров 863 тыс.
10 Python Shortcuts You Need To Know
27:27
Просмотров 291 тыс.
How To Predict Random Numbers Generated By A Computer
13:54
How to Generate Pseudorandom Numbers | Infinite Series
14:19
КОГДА БАТЕ ДАЛИ ОТПУСК😂#shorts
00:59