Imagine I have the characters:
H, M, L
I want to create sorted arrays like this:
var array1 = [ "H", "M", "L", "L", "M", "H" ];
My goal is to avoid having more than one unique character in the first three and last three characters when using the shuffle()
function on the array.
For example:
var wrong = [ "H", "M", "M", "H", "M", "L" ]; // note the two M's in the first three values
If I shuffle the array like this:
var array2 = array1.shuffle();
then there might be duplicate characters.
I need help figuring out how to ensure there are no duplicated characters in the first and second sets of three values in the array?
EDIT: Changed random to sorted.