Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Using External Crates | Rust Fundamentals lesson | BraveProgrammer
  1. Courses
  2. /
  3. Rust Fundamentals

Lesson 32 of 50

·rust

Using External Crates

15 minutes

Course progress64%

Using External Crates

Add dependencies to Cargo.toml and import them in code.

[dependencies]
rand = "0.8"
use rand::Rng;

fn main() {
    let mut  = rand::();
     :  = rng.(..=);
    (\
rng
thread_rng
let
n
u8
gen_range
1
10
println!
"Random number: {}\", n); }
Make it stickPractice what you've learned1 quiz · 1 practical test · Optional activities from Rust FundamentalsBrowse activities
Previous lessonBuilding a CLI ApplicationContinue to lesson 33Async Programming BasicsBack to Rust Fundamentals curriculum