Skip to content
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

Add seed to the random choice #1

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

scrummyin
Copy link
Contributor

This allows for the ability to use a seed for the random number
generator. This means that a seed value can be used to get a
deterministic HRID, by using the same seed as previous on any
consecutive runs.

An example of the run is below

>>> import hrid
>>> hrid.hrid.HRID(seed='seed').generate() == hrid.hrid.HRID(seed='seed').generate()
True
>>> hrid.hrid.HRID(seed='seed').generate() == hrid.hrid.HRID(seed='seedsssssssss').generate()
False
>>> hrid.hrid.HRID(seed='seed').generate() == hrid.hrid.HRID(seed='seed').generate()
True

This allows for the ability to use a seed for the random number
generator. This means that a seed value can be used to get a
deterministic HRID, by using the same seed as previous on any
consecutive runs.
Copy link

@pierec pierec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Some tests would be in order.

@pierec
Copy link

pierec commented Jul 4, 2024

@hnimminh is there any interest in merging this PR and releasing a new version of the package?

@hnimminh
Copy link
Owner

hnimminh commented Jul 4, 2024

@pierec Somehow I missed this for longtime. I will update soon.
@scrummyin thanks for your contribution

@hnimminh hnimminh merged commit 03fc24b into hnimminh:master Jul 4, 2024
@hnimminh hnimminh self-assigned this Jul 4, 2024
@hnimminh
Copy link
Owner

hnimminh commented Jul 4, 2024

@pierec https://pypi.org/project/hrid/ 0.2.4 ^^

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