No problem!
2011/1/13 natalia Vikhtinskaya
> THANK YOU AGAIN!!!
>
> 2011/1/13 Juan Pablo Califano :
> > PS:
> >
> > I mentioned that a random sort was not the best approach.
> >
> > Here's a better way to randomize an array:
> >
> > public static function shuffle(array:Array):void {
> >var
THANK YOU AGAIN!!!
2011/1/13 Juan Pablo Califano :
> PS:
>
> I mentioned that a random sort was not the best approach.
>
> Here's a better way to randomize an array:
>
> public static function shuffle(array:Array):void {
> var tmp:*;
> var cur:int;
> var top:int;
>
> cur = top = array.
Thank you very much!! Now it works well.
2011/1/13 Juan Pablo Califano :
> Try this:
>
> function uniqueRandomInt(min:Number, max:Number, n:Number) {
> var a:Array = [];
> var i:Number = min;
> while (a.push(i++) a.sort(function (a:Number, b:Number) {
> return Math.floor(Math.random()*3)-1;
>
PS:
I mentioned that a random sort was not the best approach.
Here's a better way to randomize an array:
public static function shuffle(array:Array):void {
var tmp:*;
var cur:int;
var top:int;
cur = top = array.length;
if(top) {
while(--top) {
cur = Math.
Try this:
function uniqueRandomInt(min:Number, max:Number, n:Number) {
var a:Array = [];
var i:Number = min;
while (a.push(i++) 0)
as evenly distributed as possible. Math.random gives you a number that
is great or equal to 0 and *less* than 1. It will not give you 1 back
(0.9, but not 1
Hi
I use function that creates unique array
function uniqueRandomInt(min:Number, max:Number, n:Number) {
var a:Array = [];
var i:Number = min;
while (a.push(i++)http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
6 matches
Mail list logo