Last active
October 12, 2021 20:37
-
-
Save btquanto/315570f5fffbd83023add7fbc8d78d2b to your computer and use it in GitHub Desktop.
Genshin Impact drop rate simulation reverse engineer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from random import randint | |
SIMULATIONS = 1000000000 | |
RATE = 6 # The base rate to get a 5* item is 0.6% | |
chances = dict([(i, 0) for i in range(1, 91)]) | |
times = 0 | |
for i in range(SIMULATIONS): | |
if i % (SIMULATIONS / 10000) == 0: | |
# Tracking simulation progress | |
print("Simulating: {}%".format("%.2f" % (i / SIMULATIONS * 100)), end='\r', flush=True) | |
if times < 75: | |
# For the first 75 pulls, the rate remain constant | |
chance = randint(1, 1000) | |
else: | |
# The rate increases gradually to 100% for the last 15 pulls | |
chance = randint(1, 95 - times) | |
if chance <= RATE: | |
# Successfully got a 5* item | |
chances[times + 1] += 1 | |
times = 0 | |
else: | |
times += 1 | |
total = sum(chances.values()) | |
percents = [(key, value / total * 100) for key, value in chances.items()] | |
for values in zip(*[percents[i:i + 15] for i in range(0, len(percents), 15)]): | |
print("\t".join(["{}: {}%".format(str(k).rjust(2, " "), "%.6f" % v) for k, v in values])) | |
print("\n=======\nConsolidated 5* rate including pity: {}%\n".format("%.5f" % (total / SIMULATIONS * 100))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result