Re: [LANG] Method to return random byte array?

2013-06-17 Thread Duncan Jones
On 15 June 2013 14:58, Duncan Jones wrote: > On 14 June 2013 07:55, Duncan Jones wrote: >> On 13 June 2013 21:26, Phil Steitz wrote: >>> On 6/13/13 1:03 AM, Duncan Jones wrote: > >> >>> I am not sure where this little method would fit in [lang]; but it might >>> make sense to add there in the si

Re: [LANG] Method to return random byte array?

2013-06-15 Thread Gary Gregory
On Sat, Jun 15, 2013 at 12:35 PM, Duncan Jones wrote: > On 15 June 2013 15:49, Gary Gregory wrote: > > I thought 2.6 had such a class and we got rid of it. > > 2.6 had a class by the same name (so I've discovered since your mail), > but it merely amalgamated the different random methods from Math

Re: [LANG] Method to return random byte array?

2013-06-15 Thread Duncan Jones
On 15 June 2013 15:49, Gary Gregory wrote: > I thought 2.6 had such a class and we got rid of it. 2.6 had a class by the same name (so I've discovered since your mail), but it merely amalgamated the different random methods from Math and Random. I think this new class does exactly what is requir

Re: [LANG] Method to return random byte array?

2013-06-15 Thread Gary Gregory
I thought 2.6 had such a class and we got rid of it. G On Sat, Jun 15, 2013 at 9:58 AM, Duncan Jones wrote: > On 14 June 2013 07:55, Duncan Jones wrote: > > On 13 June 2013 21:26, Phil Steitz wrote: > >> On 6/13/13 1:03 AM, Duncan Jones wrote: > > > > >> I am not sure where this little metho

Re: [LANG] Method to return random byte array?

2013-06-15 Thread Duncan Jones
On 14 June 2013 07:55, Duncan Jones wrote: > On 13 June 2013 21:26, Phil Steitz wrote: >> On 6/13/13 1:03 AM, Duncan Jones wrote: > >> I am not sure where this little method would fit in [lang]; but it might >> make sense to add there in the simple form above (with RANDOM >> static, I assume). >

Re: [LANG] Method to return random byte array?

2013-06-13 Thread Duncan Jones
On 13 June 2013 21:26, Phil Steitz wrote: > On 6/13/13 1:03 AM, Duncan Jones wrote: >> 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.

Re: [LANG] Method to return random byte array?

2013-06-13 Thread Phil Steitz
On 6/13/13 1:03 AM, Duncan Jones wrote: > 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; > } > == > >

[LANG] Method to return random byte array?

2013-06-13 Thread Duncan Jones
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, bet