Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Splankton on June 05, 2014, 02:13:19 PM
-
Hi
I have a simple hash table that iterates a few times to get a random name from an arraylist, and add that into a hash table as the key(string) and it's index(int).
It all works fine except i sometimes get 2 duplicate indexes.
So it looks a bit like this
Mike 6
Dave 3
Rob 2
Joe 5 *
Steve 0
Chris 5 *
By the way, I never get name duplicates.
I made a temp arraylist that copies from the source array, so I can get a random name, then remove it from the array, leaving the source array free from any removing.
So I don't get why I sometimes get duplicates?
Can someone help?
-
hi,
it's almost definitly in your logic that you call twice the same set of logic that leads to a duplicate.
double check your logic accuratly and use the debug flow to go trhough all the steps one by one.
Bye,
Jean
-
Hi, thanks Jean. You're right, the index from the target array was removing the picked item, so say index 3 was removed, so the item at index 4, becomes index 3 etc. Silly error, but I have it working now.