All of the values (N,dt,T) are entered by the user at the start of the program.
This code will only generate 1 random number, repeatedly. The first for loop is not working on t incrementally; it is spewing out integers plus dt.
random.seed(123) seed = random.random() seed = int() for t in range(T + 1): t = t + dt t = int(t) for seed in range(N): random.seed(123) seed = random.random() if seed > dt/tau: N = N - 1 N = int(N) print("The atom has decayed", t, N, seed) else: print("The atom has not decayed", t, N, seed) sys.exit()
Can anyone point me in the right direction or leave me with a useful website?
Aucun commentaire:
Enregistrer un commentaire