The code sample I gave you is to generate random set of letter. You can use same with your require number (here 6 letters) of length.
Use same code to generate random set of 6 letter or whatever text you need…
function randomizeArray(array:Array):Array
{
var newArray:Array = new Array();
while(array.length > 0)
{
newArray.push(array.splice(Math.floor(Math.random( )*array.length), 1));
}
return newArray;
}
var myArr:Array = new Array(‘a’, ‘b’, ‘c’,‘d’, ‘e’,‘f’);
//call function here
var newRandomArr = randomizeArray(mayArr);
Then update your textfields with values from this array.
You better decide first you need repeat values or not.
If you are fine with repeat values but you do not want it to be consecutive, then you can just check values for each consecutive field.
Say, while setting value for txt2, check whether earlier field (txt1) has same value, if it does then replace it with some new value.
Do the same for all fields.
I suggest you understand the logic first,
I do not have any sample created now but just a quick one is below
//generate random value
var newRandomValue = Math.round(Math.random()*6);
if($(’#txt1’).val() == newRandomValue)
{
//get another randomNumber
newRandomValue = Math.round(Math.random()*6);
$(’#txt2’).val(newRandomValue);
}
else
{
$(’#txt2’).val(newRandomValue)
}
Same way you can check for other textfield consecutively.
You can use while loop to check random values.
Also, you can use for each loop to check and assign value for each textfield.
Just google for for each to study some sample codes