commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duncan Jones <dun...@wortharead.com>
Subject [LANG] Method to return random byte array?
Date Thu, 13 Jun 2013 08:03:20 GMT
Hi,

A piece of code I write far too often is:

======
public static byte[] getRandomBytes(int length) {
  // validate length is non-negative

  byte[] result = new byte[length];
  RANDOM.nextBytes(result);
  return result;
}
======

Is there a place for something like this in Commons Lang? Or, better,
does this already exist in another commons project?

Duncan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message