Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: controlling random
From: Nathan Dicken
Date: Mon, 13 Mar 2000 21:57:44 GMT

Hi Matt,

Something that I have tried in the past is to create a list and then use
that to pull random values from. This might be a little bit more complex
than you need but it's accurate and works great. In this case you could
start with a "list" variable that has a value of "01020304050607080910"
The reason why there are zeros in front of the numbers less than 10 is
because there needs to be the same number of digits in each value - i.e.
"01", "02", ... "10".

The technique goes pretty much like this... Since the length of your list
is 20 and the number of characters in each value is two, then you get an
actual list length of ten (20/2). In calling this actual length
"actualLength", you'd esentially want to find a random number of
random(actualLength)+1. Let's say that this provided you with a random
value of 5. Next, you'd go back into your list and find that your fifth
value is "05". You'd need to use substring and figure in the number of
characters per list value. After you get your value from the list, figure
out the list characters prior to your value "01020304" and those after,
"0607080910" and recreate the list by putting those together.

Next, you'd figure out a new random number and go through the same process
until your list is empty. Later on a random value of 5 could give you a
list value of say, "07", or another number. If this is confusing at all
just let me know... Hope this helps.

Nathan

---------------------------
Nathan Dicken
Fusionary Media
http://www.fusionary.com




>this may be a dumb question, but...
>Is there a way to use the random function so as to assure that the same
>pictures don't get displayed twice? In other words, say I have 10
>symbols, "pic1" through "pic10". When a button is clicked, I want the
>visible of one of the 10 symbols set to true. This much I can handle.
>
>But I then want to guarantee that once a picture has been displayed, it
>will in effect be removed from the "random" pool, so that it can't be
>displayed again, and once they've all been displayed the show ends.
>Thepictures will be displayed one at a time. Thanks!
>
> MAtt
>
>
>flasher is generously supported by...
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> flashforward2000 and The Flash Film Festival
> "The World�s Premier Flash Solutions Conference and Expo"
> March 27-29, Nob Hill Masonic Center, San Francisco, California
>
>-Register before Feb 25 and save $200!!-- www.flashforward2000.com
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>To unsubscribe or change your list settings go to
>http://www.chinwag.com/flasher or email helpatchinwag [dot] com



flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and The Flash Film Festival
"The World�s Premier Flash Solutions Conference and Expo"
March 27-29, Nob Hill Masonic Center, San Francisco, California

-Register before Feb 25 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  FLASH: controlling random, Matt Spiegler

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]