markov icon indicating copy to clipboard operation
markov copied to clipboard

Add seedable generate functions

Open Nystik-gh opened this issue 3 years ago • 2 comments

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 avatar Sep 05 '22 22:09 Nystik-gh

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

RicardRC avatar Sep 16 '23 20:09 RicardRC

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.

aatxe avatar Sep 16 '23 21:09 aatxe