That example works fine with the latest code. Which version are you
running it with?
Andy
On 20/11/2015 05:43, Aaron J. White wrote:
Does anyone know the answer to this? I wanted to just use java's built
in method to shuffle and array, but encountered the same issue as Jeff.
Right now I'm using a method I pulled from CFlib, but java shuffle
would probably be better and faster.
On Tuesday, February 2, 2010 at 1:15:41 PM UTC-6, J.Lucido wrote:
I have a UDF that I have used over the years that generates random
strings, etc. that I use throughout applications. In an effort to try
and create a pretty random string I generate an array of alphanumeric
values which I then use as a "seed" array to generate a string of X
characters long.
The core of the function relies on the java.util.collections shuffle
method to randomly re-arrange the array element order. Today I tried
to use the UDF for the first time on OBD and I keep getting strings in
the order I created the seed string. I realized the issue pertained to
the lack of "randomness" in my seed array.
I stripped out my code to a test page to try and find a way to shuffle
the list and I cannot seem to get a random array "back" after invoking
the shuffle method. Here is my test:
<cfscript>
myArray = [1,2,3,4,5,'A','B','C'];
al = CreateObject("java",
"java.util.ArrayList").init(myArray);
al2 = CreateObject("java", "java.util.ArrayList").init();
c = CreateObject('java', 'java.util.Collections');
al2.add("1");
al2.add("2");
al2.add("3");
al2.add("4");
al2.add("5");
al2.add("D");
al2.add("E");
al2.add("F");
c.shuffle(al);
c.shuffle(al2);
</cfscript>
<cfdump var="#al#" />
<cfdump var="#al2#" />
You will see that both test arrays, "al" and "al2" are in the same
order as when they were created. Any ideas on how to get the
collection's shuffle method to work and OBD to return the resultant?
Any help is greatly appreciated.
Kind regards,
-Jeff Lucido
--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en
---
You received this message because you are subscribed to the Google
Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en
---
You received this message because you are subscribed to the Google Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.