Index Details
Last updated
import hashlib
from decimal import Decimal
# Assume the current Cakecoin price is 2.56788991
Cakecoin_price = Decimal("2.56788991")
# Calculate the SHA-256 hash of the Cakecoin price
price_hash = hashlib.sha256(str(Cakecoin_price).encode("utf-8")).hexdigest()
# Extract the first 4 hexadecimal digits from the hash
hash_substring = price_hash[:4]
# Convert the hexadecimal string to an integer
hash_integer = int(hash_substring, 16)
# Divide the integer by 65535 (the decimal value of the hexadecimal number FFFF), to get a number between 0 and 1
random_number = hash_integer / 65536
print(random_number)