mirror of
https://github.com/tcsenpai/llm_rng_project.git
synced 2025-06-04 10:10:04 +00:00
5 lines
265 B
Python
5 lines
265 B
Python
def map_hash_to_range(hash_hex: str, range_min: int, range_max: int) -> int:
|
|
""" Map a SHA-256 hash to a number within a given range. """
|
|
hash_int = int(hash_hex, 16) # Convert hex to integer
|
|
return range_min + (hash_int % (range_max - range_min + 1))
|