Skip to content

Update to use rand 0.9 throughout #4254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chuksgpfr
Copy link

Chapter 2. Programming a Guessing Game uses thread_rng() and gen_range(), which are deprecated.
I replaced every thread_rng() with rng(), and every gen_range() with random_range()

The function is also referenced in a few other areas, of which I updated.

Since this issue HERE was closed

@chuksgpfr chuksgpfr changed the title Use non deprecated functions in Chapter 2. Programming a Guessing Game Update to use rand 0.9 throughout Mar 2, 2025
@chuksgpfr
Copy link
Author

@chriskrycho any possibility for this merge, seems quite some people get thrown off when this does not work their way.

@Ahorts
Copy link

Ahorts commented Jun 14, 2025

I was just thinking of opening a PR on this. I wonder why this hasn't been reviewed and merged yet.

@chuksgpfr
Copy link
Author

I was just thinking of opening a PR on this. I wonder why this hasn't been reviewed and merged yet.

@chriskrycho People are waiting for this.

@carols10cents
Copy link
Member

We're currently working on updating the print version, and updating the rand crate is not going to be part of that. Once we're done with that work, we'll review this.

New versions of rand being released are why we have this note:

Be sure to specify rand exactly as we have here, with this version number, or the code examples in this tutorial
may not work:

If people follow the instructions, there should be no problems.

@552020
Copy link

552020 commented Jul 11, 2025

We're currently working on updating the print version, and updating the rand crate is not going to be part of that. Once we're done with that work, we'll review this.

New versions of rand being released are why we have this note:

Be sure to specify rand exactly as we have here, with this version number, or the code examples in this tutorial
may not work:

If people follow the instructions, there should be no problems.

I'm not sure what you mean. Following exactly the instructions of the book (online), "specifyingrand exactly as we have here", doesn't give the same result as in the book because of the deprecation. I mean: you get the same result but you get also the warnings.

@carols10cents
Copy link
Member

mean: you get the same result but you get also the warnings.

As you said, you get the same result -- the functionality of the program is not affected. Warnings are just fine, as we state here:

compile will continue to compile with newer Rust versions. The output might
differ slightly between versions because Rust often improves error messages and
warnings. In other words, any newer, stable version of Rust you install using

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy