I need help to write a python code for a high school project to simulate the cut-off phenomenon. The code needs to use the mathematical equation listed down below.

The code have to also give me an “r” value from 0-1 where 1 is sufficiently shuffled and 0 is not shuffled after “k” amount of shuffles.

fi is permutation

n is cards

k is shuffles

Here is a written analysis which I work with, everything that has been listed above should have a written explanation in the paper.

Thank you for your help. /Kaiser