Errors during compilation code from lesson 2

I programming guessing game from book however i have errors.

error[E0432]: unresolved import rand
--> src\
1 | use rand::Rng;
| ^^^^ use of undeclared type or module rand

error[E0433]: failed to resolve: use of undeclared type or module rand
--> src\
8 | let secret_number = rand::thread_rng().gen_range(1, 101);
| ^^^^ use of undeclared type or module rand

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try rustc --explain E0432.
error: could not compile proba.

Code is the same how in documentation. Please help. Sorry for my bad language.

You need to add the rand crate to your dependencies as described here.

1 Like

Thank you :grinning:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.