summaryrefslogtreecommitdiffstatshomepage
path: root/examples/pyb.py
blob: f7b52a2a1e347f65f6065ee02b103c26e6be88c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# pyboard testing functions for CPython
import time


def delay(n):
    time.sleep(float(n) / 1000)

rand_seed = 1
def rand():
    global rand_seed
    # for these choice of numbers, see P L'Ecuyer, "Tables of linear congruential generators of different sizes and good lattice structure"
    rand_seed = (rand_seed * 653276) % 8388593
    return rand_seed