[RESOLVE] Issue with rand


#1

Hi,
(sorry for my bad english ;P)
I just started rust this morning.

I don’t find the probleme. If i can copy/paste the code in book, i have the same error.

here the code

The compiling error is :

src\main.rs:11:25: 11:41 error: unresolved name `rand::thread_rng`
src\main.rs:11     let nombre_secret = rand::thread_rng().gen_range(1, 100);

#2

You are missing extern crate rand; at the top.


#3

Uups! Just missing to paste it :stuck_out_tongue:

Edited.


#4

Did you add the rand crate as a dependency in your Cargo.toml file? https://doc.rust-lang.org/book/guessing-game.html#generating-a-secret-number


#5

Aah…
Nop.

Thank’s <3