I always gets confused when people ask me to generate random string which is of 300 bytes or some predefined bytes. I am not sure what does they mean in general? Are they asking that string should be of 300 length?
I am working on a project in which people have asked me to generate random String of approximately 300 bytes.
Is it possible to do? I am confuse how we can generate random string of 300 bytes?
I know how to generate random string like this -
private static final Random random = new Random();
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
public static String generateString(int length) {
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i++) {
sb.append(CHARACTERS.charAt(random.nextInt(CHARACTERS.length())));
}
return sb.toString();
}
Can anyone explain me what does it mean when we need to generate random string of approx 300 bytes?