Generating random numbers in modern C++

  Рет қаралды 655

Code for yourself

Code for yourself

Күн бұрын

🎲 Here we talk about (pseudo-)random number generation. We briefly look at how to generate those correctly in modern C++ and why using rand() is not the best idea.
📚 Slides: github.com/cpp-for-yourself/s...
🎓 More on C++ reference website: en.cppreference.com/w/cpp/num...
If you want to learn more about random number generation, here are two resources:
- Random Numbers and Computers book: amzn.to/3xDaWu1
- Technical report on random number generation: www.pcg-random.org/pdf/hmc-cs...
I'm using this Xkcd comic in my slides: xkcd.com/221/
Please support my free work 😉🙏
- Through Patreon: / code_for_yourself
- Through GitHub Sponsors: github.com/sponsors/niosus
Get a FREE Audible trial here
- US: www.audibletrial.com/CodeForY...
- DE: www.amazon.de/hz/audible/mlp?...
Alternatively, buy stuff through my affiliate links
- Keyboard I'm using: Logitech MX Keys: amzn.to/3SbOhg8
- Mouse I'm using: Logitech MX Vertical: amzn.to/3qVYYI4
- My monitor: Dell P2720DC: amzn.to/3Bthv3A
- My camera: Sony a6400: amzn.to/3duP39x
- Microphone: Rode Wireless GO II: amzn.to/3QUH2sc
Contents:
00:00 - Intro
00:24 - What are random numbers
01:00 - Pseudo-random numbers
02:07 - How to generate random numbers in C++
04:19 - Example
06:32 - Why not use rand()?
09:16 - Outro

Пікірлер: 6
@kompila
@kompila Жыл бұрын
Contagious smile through out the lesson. Good Energy Igor!
@CodeForYourself
@CodeForYourself Жыл бұрын
Thanks! Smiling at the camera does not come naturally for me, so thanks for noticing 😉
@graffioh6785
@graffioh6785 Жыл бұрын
Great video
@nicodell6192
@nicodell6192 Жыл бұрын
He who attempts to generate random numbers by deterministic means is, of course, living in a state of sin - John von Neumann My second favourite random numbers related quote/meme... the xkcd dice roll is my favourite.
@marwanzaghloul6065
@marwanzaghloul6065 Жыл бұрын
Great!
@aslamjm
@aslamjm Жыл бұрын
thanks🙏
Homework: the guessing game
1:49
Code for yourself
Рет қаралды 306
Don't use static (outside of classes) in modern C++
15:56
Code for yourself
Рет қаралды 4,9 М.
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 12 МЛН
Пробую самое сладкое вещество во Вселенной
00:41
Random Number Generation - C++ Tutorial 15
10:16
Caleb Curry
Рет қаралды 6 М.
Const correctness in C++
10:02
Code for yourself
Рет қаралды 2,7 М.
Effortlessly Write Bug-Free Code
14:49
Frankly Developing
Рет қаралды 549
Re-inventing move semantics in modern C++ in 13 minutes
13:20
Code for yourself
Рет қаралды 6 М.
C++ Random Number Generator AKA STOP USING Rand()
7:20
The Builder
Рет қаралды 53 М.
Do you even test? (your code with CMake)
12:38
Code for yourself
Рет қаралды 19 М.