Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Splankton on June 05, 2014, 02:13:19 PM

Title: duplicates in an array/hash[SOLVED]
Post 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?
Title: Re: duplicates in an array/hash
Post by: jeanfabre on June 06, 2014, 06:58:21 AM
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
Title: Re: duplicates in an array/hash
Post by: Splankton on June 06, 2014, 02:00:43 PM
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.