Giter VIP home page Giter VIP logo

Comments (4)

dhardy avatar dhardy commented on July 3, 2024 1

Is this what you want?

Sorry, I don't quite follow. If you know how to improve the documentation though, a contribution would be very welcome!

To answer your bullet points:

  • SeedableRng::seed_from_u64 is the easiest way to seed from an integer
  • Don't know what you mean here; you can't implement traits on typedefs anyway. You do have to "use" (import) traits.
  • No; all the bits of rand_core (other than utilities for implementing new RNGs) are availble in rand too
  • Yes, you should decide on a PRNG. Probably any of the ones we have are suitable for procedural generation, crypto or not (the main difference being crypto ones use more memory and batch their generation). If you want reproducible generation across library versions, then don't use SmallRng / StdRng; you may want to look at the rand_xoshiro and rand_pcg crates (first one isn't published yet but hopefully will be later today)

from book.

Harnesser avatar Harnesser commented on July 3, 2024 1

Thanks - the first example was especially useful!

I would have like to have found a "recipe" page in the docs with:

  • the above example
  • some of your remarks above
  • and maybe notes on re-seeding in an interactive application
  • with links to more in-depth section in the rand-book

I'd like to have a go at creating such a page for documentation, as thanks for your help. I'm not sure if the page would be best in the rand book, or in the main Rust Cookbook. What do you think?

Thanks again!

from book.

dhardy avatar dhardy commented on July 3, 2024

It's also worth noting that using gen_range or the Uniform distribution may be a little faster and more accurate than using gen() and modifying/shifting the result. Here's an expanded example.

from book.

dhardy avatar dhardy commented on July 3, 2024

I'm not sure if the page would be best in the rand book, or in the main Rust Cookbook. What do you think?

Depends where people are more likely to look for such documentation?

The book as it stands was written fairly quickly to at least have some doc beyond the API. It could certainly be expanded significantly. I can't gauge what content all readers want and also don't currently want to contribute new content to the book myself, but if you would like to I would be happy to review.

from book.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.