Integer len = 5; String str = string.valueof(Math.abs(Crypto.getRandomLong())); String randomNumber = str.substring(0, len); system.debug('Random Number-' + randomNumber);
How to generate random number using Apex?
Biswajeet
September 22, 2015 7 Comments on How to generate random number using Apex?