your asking for math and logic for RNG. Closest thing you will get is statistics...