| Crates.io | deterministic_default_hasher |
| lib.rs | deterministic_default_hasher |
| version | 0.14.2 |
| created_at | 2024-11-15 11:40:25.071642+00 |
| updated_at | 2025-04-08 06:40:30.930143+00 |
| description | A deterministic initialisation of the stdlib default hasher |
| homepage | |
| repository | https://github.com/sebschmi/deterministic-default-hasher |
| max_upload_size | |
| id | 1449029 |
| size | 4,830 |
Annoyed by your rust hashtables behaving differently each execution, and making reproducing bugs a matter of luck? Worry no more, simply use the deterministic default hasher, which is nothing else than a special constructor for the default hasher that always chooses the same seed, instead of using a random one.
use deterministic_default_hasher::DeterministicDefaultHasher;
let map = HashMap::<String, usize, DeterministicDefaultHasher>::new();
The third argument defaults to DefaultHasher.
Using DeterministicDefaultHasher instead makes the hash map deterministic.