A mock functions to replace Math.random() for testing