If you do not care if the sequences repeat, you could fill an array with
the numbers from 1 to 100 arranged in a random order.
When you want to grab 10, just pick a random integer between 0 and 89
and grab the block of 10 numbers following that point.
This would charge a penalty once when you
yes like:
allNumbers:Array = [ 0, 1, 2, 3, ..., 100 ];
tenNumbers:Array = [];
public function getNumberIn():void{
var n:int = tenNumbers.splice( int( Math.random * 10 ), 1 );
tenNumbers.push( allNumbers.splice( int( Math.random *
allNumbers.length ), 1 ) );
No, that is not the only way you can target a path in the MAC. for example I
different projects some require to distribute the PPV classes with the
project so i add the classes inside the same folder I am working on.
/Application.as
/src/
/src/ppvclasses
Then in my application I just do:
import
wrong thread... oh my and its only tuesday!
On Tue, Jul 29, 2008 at 9:57 AM, Helmut Granda [EMAIL PROTECTED]wrote:
No, that is not the only way you can target a path in the MAC. for example
I different projects some require to distribute the PPV classes with the
project so i add the classes
That's a good idea!
Ron Wheeler a écrit :
If you do not care if the sequences repeat, you could fill an array
with the numbers from 1 to 100 arranged in a random order.
When you want to grab 10, just pick a random integer between 0 and 89
and grab the block of 10 numbers following that
I'm sure this isn't needed by now, just thought I'd take it as a fun
challenge.
var rangeMin:int = 0;
var rangeMax:int = 100;
var rangeSample:int = 10;
// copy
var numbers:Array = [];
// original values
var numberList:Array = [];
for ( var i:int = 0; i = (rangeMax - rangeMin); i++ )
This is very similar to what other people have already said. Basically, you
can have two lists: one acts as a pool from where you'll grab numbers,
randomly; the other one is a sequence of unique numbers.
First, you fill the pool with numbers that fall between some range. Then you
take one of the
you could make a first array filled with all number from 0 to 100 and
then you splice to any random index range between 0 and the new size of
the array.
You fill another array with the last spliced number. do I make sense ?
cheers
L
Eduardo Barbosa a écrit :
Hi all!
What I am trying to
oops no i did not get you point actually..
hm...more complex...:)
L
Eduardo Barbosa a écrit :
Hi all!
What I am trying to figure out is this:
How to generate a sequence of random numbers where the newest is always
different from all the previous?
I need to continuosly rewrite an array of 10
still it can be done like that you always keep the number of numbers
between two arrays...
and swap numbers from one to another, that your sure to neve have twice
the same one
yeah...! :]
L
Eduardo Barbosa a écrit :
Hi all!
What I am trying to figure out is this:
How to generate a sequence
Every time you generate a new random number go through the array and see if
any match the new number if so generate a new one and check again, if not
add it to the array.
With only 10 numbers in the array it would check very fast so you wouldn't
be taking a performance hit.
-Original
Can numbers repeat? Is this a constant loop where, for instance, the
number 12 could show up two times in twenty seconds? Or would you want
12 to show up once and then go out of circulation permanently?
.m
On Mon, Jul 28, 2008 at 5:42 PM, Eduardo Barbosa [EMAIL PROTECTED] wrote:
Hi all!
What
Hi Matt,
Yes numbers can and should repeat through time. They just cant be repeated
within the sequence at a given discreet time. Makes sense? :)
On Mon, Jul 28, 2008 at 11:15 PM, Matt S. [EMAIL PROTECTED] wrote:
Can numbers repeat? Is this a constant loop where, for instance, the
number 12
Hi Laurent,
Your first suggestion is a very simple and clever trick i'll definetely keep
in mind for future situations.
However for this second variation you mean that I:
1) pick the numbers out of array 1 and splice it
2) move those numbers into array 2
3) when the length of array 1 would be
Hi Steve,
That was actually my first thought. I had a while loop and inside a for ...
in loop to iterate through the array to check if the number was already
there. But then for some reason the script made flash unresponsive.
However I just came up with this which seems to be working, but i'm
yes like:
allNumber:Array = [ 0, 1, 2, 3, ..., 100 ];
tenNumbers:Array = [];
public function getNumberIn():void{
var i:in = int( Math.random * allNumber.length );
tenNumbers.push( allNumber.splice( i, 1 ) );
}
then I don't know how you pick up the number to pass from tenNumbers
or perhaps tenNumber[ tenNumbers.length ] is faster than
tenNumbers.push() never know about that one...the second return
something so perhaps its slower..
laurent a écrit :
yes like:
allNumber:Array = [ 0, 1, 2, 3, ..., 100 ];
tenNumbers:Array = [];
public function getNumberIn():void{
yes like:
allNumbers:Array = [ 0, 1, 2, 3, ..., 100 ];
tenNumbers:Array = [];
public function getNumberIn():void{
var n:int = tenNumbers.splice( int( Math.random * 10 ), 1 );
tenNumbers.push( allNumbers.splice( int( Math.random *
allNumbers.length ), 1 ) );
18 matches
Mail list logo