Tested on greater m values and hardcoded different random value range