Skip to content

Instantly share code, notes, and snippets.

View haritonch's full-sized avatar

Chariton Charitonidis haritonch

View GitHub Profile
import numpy as np
import matplotlib.pyplot as plt
from math import comb
def tax_coefficient(r):
if r <= 100:
return 0
elif 100 < r <= 200:
return 0.025
elif 200 < r <= 500:
@haritonch
haritonch / tzoker.rs
Last active August 6, 2025 23:50
Monte Carlo simulation for Tzoker
use rand::{seq::SliceRandom, Rng};
use rayon::prelude::*;
use rust_decimal::{prelude::FromPrimitive, Decimal};
use std::time::Instant;
use std::{cmp::min, str::FromStr};
const EXPECTED_TOTAL_COUPONS_PLAYED: u32 = 7_000_000;
const N_SIMULATIONS: u32 = 10_000;
const JACKPOT: u32 = 22_000_000;
const SECOND_CATEGORY_POT: u32 = 2_000_000;
@haritonch
haritonch / union-find.py
Last active February 28, 2020 14:19
Union Find implementation in Python 3
class Node:
def __init__(self, val):
self.value = val
self.size = 1
'''size holds the number of a node's offsprings
it is used when we apply union
'''
self.parent = self
def find(x):