Have a look at my crib sheet for alternatives to Math.random.
You might find my PM N-Back online demo useful