Skip to main content
deleted 2 characters in body
Source Link
Nonick
  • 241
  • 1
  • 8

I hope you're not hard coding passwords, here's a few lines to generate a random alphanumeric char. Use as you will.

final String selectionString = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
Integer idNum = Math.mod(Math.abs(Crypto.getRandomInteger()), selectionString.length());
String randomChar = selectionString.substring(idNum, idNum+1);

I hope you're not hard coding passwords, here's a few lines to generate a random alphanumeric char. Use as you will.

final String selectionString = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
Integer idNum = Math.mod(Math.abs(Crypto.getRandomInteger()), selectionString.length());
String randomChar = selectionString.substring(idNum, idNum+1);

I hope you're not hard coding passwords, here's a few lines to generate a random alphanumeric char. Use as you will.

final String selectionString = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
Integer idNum = Math.mod(Math.abs(Crypto.getRandomInteger()), selectionString.length());
String randomChar = selectionString.substring(idNum, idNum+1);
Source Link
Nonick
  • 241
  • 1
  • 8

I hope you're not hard coding passwords, here's a few lines to generate a random alphanumeric char. Use as you will.

final String selectionString = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
Integer idNum = Math.mod(Math.abs(Crypto.getRandomInteger()), selectionString.length());
String randomChar = selectionString.substring(idNum, idNum+1);