dimanche 2 octobre 2022

Why im getting 2 different results on the same seed number?

I'm having trouble working out why this seed number gives 2 different results, if anyone has any information on why its giving different returns it would be muchly appreciated.

I've printed the flip before rounding the value and it comes to 0.27... (same for both methods) yet when I round the bear different results

import random

test_seed = int(input("Create a seed number: ")) # when seed number is: 23412
random.seed(test_seed)


flip = round(random.random())
if flip == 0:
    print("Tails")
else:
    print("Heads")


flip = random.randint(0,1)
if flip == 0:
    print("Tails")
else:
    print("Heads")



Aucun commentaire:

Enregistrer un commentaire