| Crates.io | rand_set |
| lib.rs | rand_set |
| version | 0.1.2 |
| created_at | 2025-07-16 19:19:33.393172+00 |
| updated_at | 2025-07-17 12:24:30.886165+00 |
| description | A hash set with O(1) random element access and all standard set operations |
| homepage | https://github.com/RonHachmon/rand_set |
| repository | https://github.com/RonHachmon/rand_set |
| max_upload_size | |
| id | 1756391 |
| size | 21,714 |
A high-performance hash set implementation with O(1) random element access and all standard set operations.
Add this to your Cargo.toml:
[dependencies]
rand_set = "0.1"
use rand_set::RandSet;
let mut set = RandSet::new();
set.insert("hello");
set.insert("world");
// Fast containment check (works like HashSet)
assert!(set.contains(&"hello"));
// Unique feature: Get a random element in O(1)
if let Some(random_item) = set.get_rand() {
println!("Random: {}", random_item);
}
This project is licensed under the MIT License - see the LICENSE file for details.