Copy link to clipboard
Copied
In Flash Builder 4.6 I get an error for this:
var testVector:Vector.<*> = new Vector.<*>();
trace(testVector.length);
Sometimes the error shows up in the "Problems" panel and pointing at the trace it says something about byte code. Other times it just shows the "?" symbol next to the trace command that says "Access of undefined property length".
When I test the movie there are no runtime errors.
Can someone explain this?
cheers.
Copy link to clipboard
Copied
Why would you do that anyway?
If the thing about vectors over arrays is there speed because they don't have to resolve datatypes, setting it to an untyped * seems a bit weird. You could use Vector.<Object> instead which is practically the same thing, but is at least a defined type so might eliminate the compiler warning.
But, again, why do this?
When I use Vector, it is because I want to do fast operations with a set of items of a known datatype or interface and, for that, Vector makes coding exceptionally easy and satisfying. But with a pretty much undefined type like * or Object, all of those advantages are lost as, at the very least, you have to do type checking interrogation whenever you want to process what you have.
G
Copy link to clipboard
Copied
Hi Gaius,
There are lots of reason why I would want to use a vector this way.
One is for building a shuffle function that will shuffle any type of Vector.
public function shuffleArray(array:Vector.<*>):void
{
for (var i:int = array.length-1; i >=0; i--)
{
var randomIndex:int = Math.floor(Math.random()*(i+1));
var itemAtIndex:Object = array[randomIndex];
array[randomIndex] = array;
array = itemAtIndex;
}
}
var testVector:Vector = new Vector.<uint>( [1, 2, 3, 4] );
shuffleArray(Vector.<*>(testVector));
Changing it from * to Object did not work.
Thanks.
Copy link to clipboard
Copied
Very surprised if that doesn't work as vector.<Object>.
I can see why that would be useful, but the same could be achieved with;
[code]
public static function randomSort(a:*,b:*):int { return Math.random()>0.5?1:-1; }
var testVector:Vector.<uint> = Vector.<uint>([1,2,3,4]);
testVector = testVector.sort(randomSort);
[/code]
(Plus there is the possibility of an invalid index with your sort function when random returns 1.)
G
Copy link to clipboard
Copied
Hi Gaius,
When using a * or Object with a Vector the code does work, but Flash Builder shows the "?" mark error, and sometimes, for some strange reason, will show the "!" problem. Please read my original post.
The sort method for randomizing doesn't produce a very good result.
"...there isn’t an even 1/26 chance that any given letter will end up in any given slot. This is because we’re only swapping adjacent pairs of elements, and doing no more than that. Still, it’s a neat method..."
That quote is taken from here: http://active.tutsplus.com/tutorials/actionscript/quick-tip-how-to-randomly-shuffle-an-array-in-as3/
cheers.
Copy link to clipboard
Copied
That's a good article, but my comment on invalid index still holds with what you have. One of his other approaches would avoid that.
For the undefined property length, I think the compiler is struggling to deduce properties when it is expecting a defined type and is receiving instead *.
Vector is intentionally specific about typing because that is one of the ways it makes its performance gains - it can run more efficiently when it doesn't need to interrogate each piece of data to deduce what it is etc.
G
Copy link to clipboard
Copied
This avoids the problem and means you can use the function with Array as well as with Vector.
[code]
protected static function randomSortArrayOrVector(a:Object):void {
if(a.hasOwnProperty('length')) {
var l:int = a['length'];
for (var i:int = l-1; i>-1; i--)
{
var randomIndex:int = int(Math.random()*(l-1));
var itemAtIndex:Object = a[randomIndex];
a[randomIndex] = a;
a = itemAtIndex;
}
}
}
[/code]
Copy link to clipboard
Copied
OK, I take that back, I read up on the docs and see that Math.random() returns 0 <= n < 1 where I thought it was <=1.
I also ran a test bed on the Math.random() thing and I see what your man means. My method of calculating the index gave a slight imbalance towards the end of letter distributions, but I can't see why!
Have reverted to yours for the below, on first run it looked good, but I am seeing a cluster around the original letter position? (EG: Follow position 0 for a, position 1 for b etc. and you will see they have a disproportionate number there.)
G
[code]
protected function doTheTest():void {
var iterations:uint = 100000;
var index:Dictionary = new Dictionary;
var i:int = 0;
var letter:String;
var pos:int;
var currentLetterIndex:Vector.<uint>;
var toSort:Vector.<String>;
var testSource:Vector.<String> = Vector.<String>(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]);
testSource.fixed = true;
var posIndex:Vector.<uint> = new Vector.<uint>;
posIndex.length = testSource.length;
posIndex.fixed = true;
// Build the index using a copy of the posIndex input.
for(i=0;i<testSource.length;i++) index[testSource] = posIndex.concat();
// TEST USING JUST RANDOM
for(i=0;i<iterations;i++) {
// Use a concat to prevent sort changing inputs
toSort = testSource.concat();
toSort = toSort.sort(function (a:*,b:*):int { return Math.random()>0.5?1:-1; });
for(pos=0;pos<toSort.length;pos++) {
letter = toSort[pos];
currentLetterIndex = index[letter] as Vector.<uint>;
currentLetterIndex[pos]++;
}
}
trace("@@@@@ USING RANDOM @@@@");
for(i=0;i<testSource.length;i++) {
letter = testSource;
currentLetterIndex = index[letter] as Vector.<uint>;
trace("POSITION COUNT OF "+letter+" is:"+index[letter].join(","));
}
// Test using function
for(i=0;i<iterations;i++) {
// Use a concat to prevent sort changing inputs
toSort = testSource.concat();
randomSortArrayOrVector(toSort);
for(pos=0;pos<toSort.length;pos++) {
letter = toSort[pos];
currentLetterIndex = index[letter] as Vector.<uint>;
currentLetterIndex[pos]++;
}
}
trace("@@@@@ USING SORT FUNCTION @@@@");
for(i=0;i<testSource.length;i++) {
letter = testSource;
currentLetterIndex = index[letter] as Vector.<uint>;
trace("POSITION COUNT OF "+letter+" is:"+index[letter].join(","));
}
}
protected static function randomSortArrayOrVector(a:Object):void {
if(a.hasOwnProperty('length')) {
var l:int = a['length'];
for (var i:int = l-1; i >=0; i--)
{
var randomIndex:int = Math.floor(Math.random()*(i+1));
var itemAtIndex:Object = a[randomIndex];
a[randomIndex] = a;
a = itemAtIndex;
}
}
}
[/code] |
@@@@@ USING RANDOM @@@@
POSITION COUNT OF a is:3150,3207,3010,2741,2653,3063,4174,2606,2674,2991,3172,3889,4872,18865,3851,3356,3219,2971,2732,3930,3319,2814,2944,3058,3222,3517
POSITION COUNT OF b is:6815,7482,2634,2925,3023,2921,3107,3416,3459,3508,3444,3387,3212,3170,3331,3439,3444,3375,3312,3158,3180,3339,3776,4356,5441,7346
POSITION COUNT OF c is:6149,5382,8320,2133,2209,2931,3224,3274,3427,3438,3290,3114,2888,2859,2997,3180,3431,3493,3551,3416,3732,3906,4336,4864,5206,5250
POSITION COUNT OF d is:4516,4382,4620,9761,2966,2096,2555,3285,3365,3274,3083,2785,2603,2759,2730,3145,3469,3706,3752,3890,4169,4343,4888,4868,4797,4193
POSITION COUNT OF e is:3418,3385,4878,4681,11058,3387,2456,2421,2769,3163,2892,2596,2457,2390,2622,2934,3392,3813,4177,4334,4471,4700,4857,4672,4364,3713
POSITION COUNT OF f is:3178,3193,4506,4454,5179,11514,3753,2834,2303,2027,2308,2454,2275,2290,2466,2960,3444,3941,4292,4489,4647,4824,4686,4498,4058,3427
POSITION COUNT OF g is:3035,3073,3577,4665,4627,5549,11737,4087,3112,2132,1750,1557,1789,2331,2568,2930,3469,3979,4324,4564,4606,4686,4468,4278,3757,3350
POSITION COUNT OF h is:3194,3121,3219,4018,3595,4356,5302,12154,3533,3078,2513,2009,1867,1874,2414,2967,3466,4079,4251,4441,4409,4535,4436,3912,3792,3465
POSITION COUNT OF i is:3460,3486,3287,3430,3748,3089,3875,4449,12535,3322,2844,2694,2401,2421,2671,2886,3405,3980,4252,4225,4137,4181,4016,3803,3734,3669
POSITION COUNT OF j is:3757,3675,3415,3147,4020,2644,2855,3510,4389,13514,3192,2865,2896,2833,2905,3039,3367,3740,4102,3909,3678,3859,3672,3624,3666,3727
POSITION COUNT OF k is:3634,3707,3409,3020,3141,3712,2390,2780,3514,4322,15026,3388,3034,3047,3165,3287,3290,3432,4098,3759,3514,3279,3497,3508,3484,3563
POSITION COUNT OF l is:3564,3493,3382,2775,2990,4085,2299,2409,2970,3430,4434,17142,3665,3362,3419,3301,3245,3115,3767,3581,3318,3031,3144,3187,3385,3507
POSITION COUNT OF m is:3213,3343,3112,2871,2789,3128,3887,2504,2607,3228,3750,4587,18391,3865,3430,3379,3078,3046,2858,4219,3164,2925,2877,3176,3151,3422
POSITION COUNT OF n is:73,81,150,308,571,1106,2135,3639,6189,9115,11788,13690,14242,12757,9894,6957,4005,2012,880,292,98,14,4,0,0,0
POSITION COUNT OF o is:3096,3174,2864,2839,2678,2966,3400,3826,2849,2956,3121,3355,4061,5195,18308,3599,3090,2907,2645,2548,4380,3016,2836,3255,3371,3665
POSITION COUNT OF p is:3396,3317,3083,3026,2878,3017,3400,4197,3156,3107,3039,3140,3521,4147,5073,16486,3221,2919,2523,2535,3989,3072,3056,3430,3474,3798
POSITION COUNT OF q is:3650,3640,3377,3409,3183,3283,3465,3721,3714,3292,3057,2977,2999,3334,3963,4776,15045,2912,2596,2421,2562,4140,3361,3570,3714,3839
POSITION COUNT OF r is:3639,3711,3590,3727,3646,3596,3739,3887,3812,3216,3058,2854,2705,2849,3179,3988,4711,13457,2936,2571,2689,3802,3523,3555,3687,3873
POSITION COUNT OF s is:3769,3828,3832,4172,4138,3880,4010,3987,3798,3504,2908,2438,2318,2291,2679,3553,4241,5000,12631,3288,2755,2763,3986,3206,3509,3516
POSITION COUNT OF t is:3692,3761,4099,4493,4484,4423,4251,4218,3815,3462,2883,2494,2145,1895,2182,2630,3651,4920,5611,11928,3719,2874,3380,2906,3053,3031
POSITION COUNT OF u is:3786,3809,4243,4633,4804,4607,4425,4106,3902,3223,2869,2511,2216,2122,2143,2393,2793,3626,4956,5761,11321,3847,2805,3621,2702,2776
POSITION COUNT OF v is:3901,3834,4447,4785,4917,4857,4395,4187,3765,3338,2876,2482,2254,2217,2257,2467,2729,2997,3305,4342,5305,11215,3445,3708,3008,2967
POSITION COUNT OF w is:4119,4132,4657,4947,4837,4714,4345,3984,3689,3328,2887,2500,2417,2350,2516,2622,2755,2857,3133,3557,3844,5094,10545,3286,3921,2964
POSITION COUNT OF x is:4535,4515,4916,4866,4544,4190,4010,3721,3610,3279,3126,2740,2661,2682,2797,2887,3123,3077,2954,2817,3418,4208,4645,10185,3771,2723
POSITION COUNT OF y is:5207,5053,4972,4476,3983,3699,3593,3462,3441,3348,3283,3049,2903,2899,3145,3336,3343,3236,3066,2914,2709,2771,4125,4476,9639,3872
POSITION COUNT OF z is:6054,6216,4401,3698,3339,3187,3218,3336,3603,3405,3407,3303,3208,3196,3295,3503,3574,3410,3296,3111,2867,2762,2692,2998,4094,10827
@@@@@ USING SORT FUNCTION @@@@
POSITION COUNT OF a is:7048,6896,6922,6642,6495,6966,8035,6402,6483,6809,7073,7718,8670,22643,7736,7221,7116,6875,6623,7677,7131,6625,6800,6941,7063,7390
POSITION COUNT OF b is:10633,11230,6457,6756,6792,6692,6971,7303,7370,7371,7234,7276,7067,7033,7248,7380,7193,7317,7085,6973,7032,7294,7618,8184,9211,11280
POSITION COUNT OF c is:9963,9370,12206,6047,6121,6835,6944,7120,7334,7346,7046,6967,6800,6727,6815,6963,7207,7300,7433,7250,7650,7631,8173,8698,9006,9048
POSITION COUNT OF d is:8432,8347,8465,13595,6812,6018,6390,7084,7266,7053,6926,6559,6392,6570,6602,6871,7326,7609,7478,7807,7926,8172,8807,8827,8576,8090
POSITION COUNT OF e is:7275,7183,8780,8527,14854,7144,6158,6350,6632,7002,6750,6560,6352,6330,6366,6728,7262,7660,8003,8206,8152,8471,8854,8506,8241,7654
POSITION COUNT OF f is:7028,7011,8403,8289,8987,15354,7533,6746,6212,5784,6127,6470,6030,6054,6297,6828,7380,7775,8164,8296,8457,8726,8496,8283,7984,7286
POSITION COUNT OF g is:6759,6885,7316,8482,8489,9464,15543,7935,6885,6009,5649,5328,5699,6170,6360,6837,7325,7786,8223,8485,8597,8552,8240,8130,7605,7247
POSITION COUNT OF h is:6992,7025,7100,7814,7429,8068,9226,15944,7358,6918,6299,5845,5777,5802,6294,6767,7369,7877,8173,8285,8309,8292,8280,7700,7691,7366
POSITION COUNT OF i is:7266,7242,7153,7312,7722,6900,7608,8355,16314,7192,6621,6512,6248,6231,6543,6751,7332,7841,8109,8013,7993,8191,7756,7744,7567,7484
POSITION COUNT OF j is:7598,7575,7144,6972,7850,6484,6684,7355,8206,17234,7042,6845,6888,6612,6761,6778,7155,7588,8040,7917,7627,7615,7505,7441,7594,7490
POSITION COUNT OF k is:7442,7647,7303,6735,6972,7552,6286,6572,7308,8254,18843,7258,6883,6913,6986,7113,7195,7365,7984,7558,7411,7179,7291,7275,7324,7351
POSITION COUNT OF l is:7428,7376,7194,6669,6800,7895,6185,6135,6817,7225,8293,20967,7465,7239,7274,7260,7071,6900,7610,7371,7239,6850,6968,7002,7329,7438
POSITION COUNT OF m is:7087,7165,6896,6675,6676,6871,7747,6262,6431,7058,7537,8384,22213,7716,7419,7231,6931,6900,6726,8026,7101,6751,6706,7166,6983,7342
POSITION COUNT OF n is:3852,3871,3988,4172,4429,4956,6124,7441,9986,12986,15719,17590,18088,16635,13686,10935,7846,5889,4687,4236,3881,3785,3829,3802,3872,3715
POSITION COUNT OF o is:6866,7064,6615,6767,6480,6823,7323,7696,6676,6793,7023,7350,7849,9114,22166,7449,6926,6765,6495,6341,8193,6843,6709,7071,7135,7468
POSITION COUNT OF p is:7193,7026,6895,6964,6695,6943,7216,8137,7037,7075,6934,6906,7501,8031,8943,20305,6953,6805,6349,6270,7931,6920,6861,7205,7249,7656
POSITION COUNT OF q is:7579,7429,7228,7229,7031,7111,7503,7598,7564,7129,7008,6713,6773,7245,7856,8638,18874,6647,6369,6336,6377,7991,7262,7386,7458,7666
POSITION COUNT OF r is:7569,7512,7489,7561,7480,7480,7618,7714,7643,7139,6896,6714,6584,6672,7008,7773,8468,17287,6842,6296,6471,7707,7444,7382,7555,7696
POSITION COUNT OF s is:7631,7652,7786,8035,8000,7669,7883,7832,7641,7318,6793,6215,6080,6106,6473,7478,8088,8843,16527,7221,6594,6627,7894,6995,7238,7381
POSITION COUNT OF t is:7595,7565,7976,8352,8392,8295,8161,8123,7658,7288,6726,6284,5956,5719,6024,6433,7496,8705,9380,15755,7497,6850,7208,6746,6893,6923
POSITION COUNT OF u is:7607,7682,8120,8468,8687,8454,8236,8038,7677,7142,6790,6347,5983,5960,6010,6198,6692,7389,8731,9681,15085,7692,6747,7415,6649,6520
POSITION COUNT OF v is:7788,7658,8249,8635,8874,8696,8176,8027,7656,7193,6633,6322,6027,6004,6098,6352,6614,6844,7214,8105,9286,15075,7225,7629,6908,6712
POSITION COUNT OF w is:7993,8006,8534,8767,8664,8648,8203,7935,7597,7150,6682,6337,6295,6167,6251,6448,6626,6782,6968,7390,7561,8914,14369,7148,7760,6805
POSITION COUNT OF x is:8353,8453,8780,8724,8248,8011,7825,7651,7523,7215,6993,6612,6547,6523,6587,6704,6916,6945,6794,6680,7174,7993,8508,14019,7617,6605
POSITION COUNT OF y is:9123,8969,8834,8331,7764,7516,7413,7130,7263,7153,7058,6787,6792,6720,7020,7295,7271,7054,6897,6784,6544,6638,7950,8492,13483,7719
POSITION COUNT OF z is:9900,10161,8167,7480,7257,7155,7009,7115,7463,7164,7305,7134,7041,7064,7177,7264,7368,7252,7096,7041,6781,6616,6500,6813,8009,14668
Message was edited by: Gaius Coffey
Copy link to clipboard
Copied
Huh.
Not happy with that, only managed to get an even distribution after
a) modifying the index selection to ensure there is
b) running the random sort twice
Otherwise, I was seeing a seemingly unavoidable cluster around the original position of the letter.
G
[code]
protected static function randomSortArrayOrVector(a:Object):void {
if(a.hasOwnProperty('length')) {
var l:int = a['length'];
for (var i:int=0;i<l;i++)
{
var randomIndex:int = i;
while(randomIndex==i) randomIndex = (Math.random()*l*1000)%l;
var itemAtIndex:Object = a[randomIndex];
a[randomIndex] = a;
a = itemAtIndex;
}
}
}
// Test using function
for(i=0;i<iterations;i++) {
// Use a concat to prevent sort changing inputs
toSort = testSource.concat();
// NOTE DOUBLE SORT!
randomSortArrayOrVector(toSort);
randomSortArrayOrVector(toSort);
for(pos=0;pos<toSort.length;pos++) {
letter = toSort[pos];
currentLetterIndex = index[letter] as Vector.<uint>;
currentLetterIndex[pos]++;
}
}
[/code]
@@@@@ USING DOUBLE SORT SORT FUNCTION @@@@
POSITION COUNT OF a is:3814,3819,3822,3938,3808,3867,3932,3750,3835,3813,3955,3854,3880,3685,3812,3757,3935,3816,3844,3823,3898,3817,3889,3796,3934,3907
POSITION COUNT OF b is:3888,3901,3833,3863,3852,3845,3894,3863,3874,3799,3793,3732,3919,3912,3828,3783,3800,3871,3826,3882,3861,3895,3718,3903,3933,3732
POSITION COUNT OF c is:3849,3732,3925,3783,3868,3838,3820,3757,3714,3929,3865,4006,3789,3836,3788,3887,3870,3989,3887,3802,3763,3868,3875,3925,3844,3791
POSITION COUNT OF d is:3944,3835,3870,3750,3741,3856,3873,3796,3863,3801,3790,3739,3938,3888,3879,3866,3789,3859,3866,3820,3816,3853,3867,3888,3912,3901
POSITION COUNT OF e is:3803,3967,3928,3802,3914,3798,3855,3851,3883,3774,3938,3838,3749,3828,3846,3959,3782,3895,3722,3967,3732,3782,3874,3802,3887,3824
POSITION COUNT OF f is:3952,3825,3901,3733,3767,3808,3844,3924,3842,3826,3725,3778,3763,3953,3848,3937,3972,3939,3916,3741,3866,3942,3875,3828,3778,3717
POSITION COUNT OF g is:3870,3888,3817,3772,3809,3875,3875,3838,3893,3922,3746,3782,3853,3894,3745,3820,3780,3684,3975,3965,3951,3778,3788,3889,3908,3883
POSITION COUNT OF h is:3891,3798,3863,3749,3766,3874,3789,3856,3876,3960,3834,3908,3933,3886,3903,3813,3844,3841,3794,3698,3876,3849,3776,3794,3966,3863
POSITION COUNT OF i is:3857,3791,3898,3854,3810,3912,3798,3866,3747,3843,3807,3892,3830,3756,3912,3852,3922,3762,3871,3852,3828,3969,3823,3848,3773,3927
POSITION COUNT OF j is:3859,3953,3801,3928,3847,3785,3783,3831,3736,3817,3733,3810,3816,3900,3848,3948,3874,3898,3928,3820,3903,3820,3814,3830,3809,3909
POSITION COUNT OF k is:3892,3822,3866,3890,3876,3785,3855,3896,3832,3735,3793,3839,3873,3876,3778,3912,3806,3876,3784,3941,3820,3752,3884,3868,3871,3878
POSITION COUNT OF l is:3872,3990,3919,3865,3878,3889,3851,3864,3787,3759,3840,3927,3900,3900,3831,3762,3901,3870,3764,3714,3748,3797,3788,3896,3759,3929
POSITION COUNT OF m is:3913,3834,3963,3771,3812,3860,3870,3881,3843,3902,3876,3795,3766,3728,3865,3771,3816,3717,3841,3846,4027,3832,3962,3796,3877,3836
POSITION COUNT OF n is:3876,3777,3833,3975,3792,3780,3925,3810,3858,3789,3954,3913,3826,3932,3798,3831,3768,3769,3837,3796,3827,3934,3864,3879,3846,3811
POSITION COUNT OF o is:3885,3720,3934,3902,3889,3729,3827,3880,3869,3804,3838,3892,3846,3797,3932,3872,3825,3849,3772,3971,3832,3773,3873,3888,3826,3775
POSITION COUNT OF p is:3858,3930,3834,3949,3954,3849,3961,3914,3805,3719,3804,3767,3870,3798,3870,3851,3760,3786,3841,3817,3883,3865,3888,3852,3799,3776
POSITION COUNT OF q is:3854,3825,3808,3837,4053,3914,3940,3709,3844,3913,3866,3760,3799,3792,3793,3850,3920,3851,3823,3856,3795,3840,3817,3834,3853,3854
POSITION COUNT OF r is:3846,3828,3856,3907,3938,3852,3806,3851,3875,3854,3882,3833,3772,3787,3718,3882,3745,3772,3815,3956,3826,3866,3897,3869,3958,3809
POSITION COUNT OF s is:3814,3877,3734,3809,3962,3792,3738,3957,3899,3902,3840,3935,3868,3765,3934,3778,3800,3830,3934,3787,3844,3789,3847,3806,3914,3845
POSITION COUNT OF t is:3827,3868,3813,3851,3856,3857,3857,3849,3836,3884,3850,3827,3779,3929,3818,3661,3939,3877,3720,3934,3836,3963,3867,3781,3785,3936
POSITION COUNT OF u is:3789,3767,3832,3853,3834,4001,3844,3791,3992,3952,3787,3864,3826,3899,3810,3834,3845,3892,3842,3799,3754,3949,3831,3891,3777,3745
POSITION COUNT OF v is:3803,3931,3845,3860,3832,3932,3837,3892,3885,3894,3858,3907,3801,3776,3860,3839,3859,3829,3749,3824,3801,3794,3894,3794,3773,3931
POSITION COUNT OF w is:3779,3760,3812,3805,3887,3776,3778,3886,3772,3810,3859,3894,3889,3879,3899,3882,3930,3850,3974,3903,3884,3839,3756,3824,3793,3880
POSITION COUNT OF x is:3737,3861,3649,3956,3775,3879,3802,3809,3904,3775,3928,3835,3868,3905,3939,3888,3881,3892,3876,3831,3908,3723,3772,3895,3857,3855
POSITION COUNT OF y is:3785,3906,3774,3745,3734,3884,3856,3730,3858,3937,3927,3835,3945,3856,3864,3903,3826,3905,3883,3833,3847,3922,3839,3812,3820,3774
POSITION COUNT OF z is:3743,3795,3870,3853,3746,3763,3790,3949,3878,3887,3912,3838,3902,3843,3882,3862,3811,3881,3916,3822,3874,3789,3922,3812,3748,3912
Copy link to clipboard
Copied
Oops!
Just noticed error in my original code as I added one index to the other...
WIll test again based on the original.
Copy link to clipboard
Copied
OK, so your original index is ok. Struggling to see why though...
@@@@@ USING i+1 AS PER ORIGINAL FUNCTION @@@@
POSITION COUNT OF a is:3813,3756,3805,3886,3896,3827,3820,3838,3847,3813,3879,3841,3816,3872,3909,3894,3849,3806,3925,3920,3804,3800,3750,3769,3876,3989
POSITION COUNT OF b is:3860,3903,3929,3727,3899,3769,3856,3812,3717,3908,3855,3927,3858,3777,3854,3845,3907,3910,3784,3806,3854,3819,3804,3912,3854,3854
POSITION COUNT OF c is:3803,3816,3811,3868,3831,3844,3844,3871,3814,3798,3758,3913,3921,3681,3930,3882,3840,3928,3871,3846,3807,3926,3843,3859,3907,3788
POSITION COUNT OF d is:3843,3919,3981,3759,3746,3755,3753,3898,3913,3717,3779,3848,3905,3863,3759,3834,3876,3847,3946,3887,3744,3841,3899,3806,3948,3934
POSITION COUNT OF e is:3848,3921,3787,3817,3850,3992,3774,3839,3890,3931,3804,3793,3826,3891,3765,3845,3792,3759,3895,3871,3903,3793,3813,3889,3804,3908
POSITION COUNT OF f is:3835,3718,3780,3839,3794,3890,3889,3851,3887,3852,3827,3761,3825,3906,3918,3863,3811,3799,4019,3913,3798,3942,3941,3806,3774,3762
POSITION COUNT OF g is:3813,3913,3907,3823,3876,3750,3868,3874,3764,3857,3818,3817,3867,3821,3802,3849,3825,3829,3809,3800,3816,3992,3861,3943,3838,3868
POSITION COUNT OF h is:3868,3769,3775,3828,3757,3970,3869,3873,3897,3841,3814,3932,3825,3857,3843,3767,3891,3770,3849,3903,3869,3859,3897,3782,3774,3921
POSITION COUNT OF i is:3940,3813,3873,3709,3821,3746,3909,3915,3869,3862,3909,3850,3841,3907,3844,3830,3767,3809,3902,3836,3858,3768,3776,3867,3919,3860
POSITION COUNT OF j is:3957,3911,3927,3880,3904,3822,3831,3863,3847,3835,3833,3706,3898,3812,3807,3910,3748,3957,3836,3812,3835,3745,3789,3900,3765,3870
POSITION COUNT OF k is:3729,3970,3831,3897,3818,3774,3825,3781,3857,3857,3825,3845,3929,3842,3812,3749,3857,3916,3845,3805,3812,3816,3881,3950,3772,4005
POSITION COUNT OF l is:3774,3763,3869,3786,3868,3888,3797,3919,3763,3980,3849,3972,3754,3909,3772,3958,3793,3876,3804,3862,3915,3818,3820,3862,3899,3730
POSITION COUNT OF m is:3755,3877,3947,3897,3792,3838,3847,3940,3858,3909,3805,3768,3806,3877,3861,3761,3921,3820,3861,3937,3845,3791,3862,3789,3813,3823
POSITION COUNT OF n is:4003,3911,3777,3977,3788,3735,3933,3777,3820,3812,3968,3887,3806,3772,3740,3946,3878,3829,3960,3777,3859,3845,3822,3792,3856,3730
POSITION COUNT OF o is:3893,3747,3912,3727,3879,3802,3955,3855,3789,3903,3851,3817,3874,3880,3874,3800,3762,3736,3838,3850,3875,3822,3842,3863,4009,3845
POSITION COUNT OF p is:3834,3762,3895,3863,3831,3841,3850,3853,3948,3792,3779,3827,3910,3869,3900,3858,3893,3854,3834,3790,3786,3810,3741,3994,3883,3803
POSITION COUNT OF q is:3930,3836,3847,3907,3757,3886,3857,3871,3926,3873,3963,3806,3868,3756,3872,3816,3938,3818,3764,3860,3738,3868,3858,3835,3822,3728
POSITION COUNT OF r is:3753,3900,3782,3875,3826,3992,3822,3851,3758,3792,3865,3880,3819,3883,3851,3745,3859,3931,3823,3830,3910,3884,3880,3816,3782,3891
POSITION COUNT OF s is:3782,3888,3956,3877,3970,3874,3892,3853,3882,3825,3775,3891,3731,3718,3839,3941,3829,3820,3892,3721,3881,3874,3852,3872,3745,3820
POSITION COUNT OF t is:3830,3759,3784,3784,3943,3850,3774,3816,3845,3814,3733,3836,3894,3870,3841,3908,3838,3997,3803,3929,3934,3749,3993,3816,3757,3903
POSITION COUNT OF u is:3854,3881,3851,3749,3869,3850,3845,3858,3917,3817,3945,3877,3782,3759,3872,3929,3797,3923,3859,3842,3870,3798,3956,3739,3860,3701
POSITION COUNT OF v is:3899,3875,3837,3862,3895,3814,3841,3891,3844,3833,3833,3812,3816,3918,3893,3850,3924,3741,3917,3563,3924,3847,3812,3798,3934,3827
POSITION COUNT OF w is:3916,3849,3782,3947,3727,3937,3796,3826,3871,3808,3943,3855,3776,3949,3797,3764,3792,3789,3669,3936,3845,3896,3828,3929,3876,3897
POSITION COUNT OF x is:3861,3788,3852,4003,3881,3824,3816,3731,3774,3932,3800,3803,3933,3802,3944,3872,3901,3906,3688,3808,3798,3918,3887,3815,3782,3881
POSITION COUNT OF y is:3801,3970,3781,3861,3862,3812,3870,3762,3892,3799,3926,3871,3912,3894,3812,3761,3895,3764,3777,3940,3842,3893,3824,3772,3817,3890
POSITION COUNT OF z is:3806,3785,3722,3852,3920,3918,3867,3782,3811,3840,3864,3865,3808,3915,3889,3823,3817,3866,3830,3956,3878,3886,3769,3825,3934,3772
Copy link to clipboard
Copied
Hi,
I didn't mean to start a discussion about approaches for shuffling an array. I just want to understand why the Vector.<*> and Vector.<Object> are giving errors in Flash Builder but running fine during run time and not giving any errors. I completely understand what an index array is for (Vector Array), but sometimes, as I demonstrated, I do need to use * or Object.
Cheers.