Skip to content

Instantly share code, notes, and snippets.

View luke14free's full-sized avatar

Luca Giacomel luke14free

View GitHub Profile
@luke14free
luke14free / efficient_random_slot.py
Last active January 20, 2016 09:29
Randomic, yet efficient slot machine simulator/combination generator with custom win profiles, figures and payoffs.
import itertools
import random
els = range(10) # elements of the slot
wins_profile = dict()
wins_profile[0] = 65
# wins_profile[10] = 15 # don't know any valid combo for this :-)
# wins_profile[20] = 10 # same here
wins_profile[50] = 5
@luke14free
luke14free / logs_generator.py
Created September 14, 2015 14:52
Generate pseudo logs for BS test
from scipy import stats
import pandas as pd
randgen = lambda n: [1 if i > .5 else 0 for i in stats.gamma.rvs(1, scale=0.7, size=n) > .5]
def truncate(l, n):
try:
ls = "".join(map(str, l))
idx = ls.index("".join(map(str, [0] * n)))