• Gary Hatfield
  • 0 Points
  • Member since 2023

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2

I have a requirement with my client wherein we are required to generate a unique random number on creation of a record in the system.

To cater to which I have written a below line of code-

integer max=6;
string password=EncodingUtil.ConvertToHex(crypto.generateAesKey(128)).substring(1,max);

this code works fine.But not sure whether this code will generate a unique random number everytime.Can anyone help me with this?

In case if this code does not generates a unique random number how can I handle through same code?