This will generate hexa decimal unique random number.
String hashString = '1000' + String.valueOf(Datetime.now().formatGMT('yyyy-MM-dd HH:mm:ss.SSS'));
Blob hash = Crypto.generateDigest('MD5', Blob.valueOf(hashString));
String randomUniquesessionId = EncodingUtil.convertToHex(hash);
system.debug('random Unique session Id:' + randomUniquesessionId);
Source : https://developer.salesforce.com/forums/?id=906F0000000AX9RIAW
This comment has been removed by the author.
ReplyDelete