Skip to content

Conversation

@Nystik-gh
Copy link

@Nystik-gh Nystik-gh commented Sep 5, 2022

For a project I need to be able to reproduce the same generation multiple times so I've implemented a way to seed the random number generator, or provide your own generator.

If there is interest in merging such functionality.


Add rand::Rng argument to States trait next() function.

Rename generate to generate_base which now takes an argument that implements rand::Rng
Rename generate_from_token to generate_from_token_base which now takes an argument that implements rand::Rng

Add new generate and generate_from_token functions that call the base functions with thread_rng().

Add the following seedable generate functions

  • generate_with_seed(seed: u64)
  • generate_with_rng<R: rand::Rng>(rng: R)
  • generate_from_token_with_seed(token: T, seed: u64)
  • generate_from_token_with_rng<R: rand::Rng>(token: T, rng: R)

Implement linked-hash-map for predictable hashmap insertion.

Add "seedable" feature

@Nystik-gh Nystik-gh changed the title Pull request add seedable Add Seedable generate functions Sep 5, 2022
@Nystik-gh Nystik-gh changed the title Add Seedable generate functions Add seedable generate functions Sep 5, 2022
@Nystik-gh Nystik-gh force-pushed the pull-request-add-seedable branch from 5afeb6f to 79094b6 Compare September 5, 2022 22:54
when seeding use rand_chacha for reproducible output across platforms
@RicardRC
Copy link

I'd like this to be merged, as I'm also interested in this feature. How could I contribute to this happening?

@aatxe
Copy link
Owner

aatxe commented Sep 16, 2023

The change looks fine to me, but we need to move the project over to GitHub Actions since it's still waiting for TravisCI which was killed long ago.

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.

3 participants