Guessing Game - Random Numbers & Game Loops in Rust | Rust by Examples (Lesson 3)
11views
005:18
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Build a classic number guessing game in Rust! Learn how to add external crates, generate random numbers, compare values, and create interactive game loops.
๐ฆ What You'll Learn:
โข Adding crates with `cargo add rand`
โข Generating random numbers with `rand::rng().random_range()`
โข Comparing values with `std::cmp::Ordering`
โข Using `match` for pattern matching
โข Creating game loops with `loop` and `break`
โข Reading and parsing user input
โฑ๏ธ Timestamps:
0:00 - Introduction
0:15 - Creating Project & Adding rand Crate
0:44 - The rand Crate Explained
1:04 - Random Number Demo
1:49 - Comparing Guesses Explained
2:09 - Comparison Logic Demo
2:59 - The Game Loop Explained
3:14 - Complete Game Demo
3:51 - Playing the Game (Binary Search Strategy!)
4:29 - Recap
4:54 - Thanks for Watching
๐ Series: Rust by Examples - Learn Rust through hands-on projects!
๐ Previous: Lesson 02 - CLI Calculator
๐ Next: Lesson 04 - Temperature Converter
๐ Code: https://github.com/codegiz/rustbyexamples
๐ Like and Subscribe for more Rust tutorials!
๐ Hit the bell to get notified of new lessons!
#rust #rustlang #programming #guessinggame #gamedev #rand #tutorial #coding #beginners #rustbyexamples
Back to tutorials๐ Read the articleOpen in YouTube
Duration
5:18
Published
January 10, 2026
Added to Codegiz
March 15, 2026