Top to random simul stop.py
From Werner KRAUTH
(Difference between revisions)
| Revision as of 13:24, 6 June 2024 Werner (Talk | contribs) ← Previous diff |
Current revision Werner (Talk | contribs) |
||
| Line 1: | Line 1: | ||
| + | ==Context== | ||
| + | This page is part of my [[BegRohu_Lectures_2024|2024 Beg Rohu Lectures]] on "The second Markov chain revolution" at the [https://www.ipht.fr/Meetings/BegRohu2024/index.html Summer School] "Concepts and Methods of Statistical Physics" (3 - 15 June 2024). | ||
| + | |||
| + | ==Python program== | ||
| import random | import random | ||
| NCards = 3 | NCards = 3 | ||
Current revision
[edit]
Context
This page is part of my 2024 Beg Rohu Lectures on "The second Markov chain revolution" at the Summer School "Concepts and Methods of Statistical Physics" (3 - 15 June 2024).
[edit]
Python program
import random
NCards = 3
data = {}
for iter1 in range(1000000):
L= [k for k in range(NCards)]
green_card = NCards - 1
for iter2 in range(2000000):
a = L.pop(0)
L.insert(random.randint(0, len(L)), a)
if a == green_card:
L = tuple(L)
data[L] = data.get(L, 0) + 1
break
for k in data:
print(k, data[k])
