Flasher Archive

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


Subject: Re: FLASH: set variable randomly, numbers should only be taken once
From: Stephen
Date: Wed, 12 Jul 2000 10:27:57 +0100

Try this, assuming you're using a,b,c,d,e:

Frame 1:
Set Variable: "a" = (Random(56)+1)

Frame 2:
Set Variable: "b" = (Random(56)+1)

Frame 3:
If (b = a)
Goto and Play (2)
End If

Frame 4:
Set Variable: "c" = (Random(56)+1)

Frame 5:
If (c = a)
Goto and Play (4)
Else If (c = b)
Goto and Play (4)
End If

Frame 6:
Set Variable: "d" = (Random(56)+1)

Frame 7:
If (d = a)
Goto and Play (6)
Else If (d = b)
Goto and Play (6)
Else If (d = c)
Goto and Play (6)
End If

Frame 8:
Set Variable: "e" = (Random(56)+1)

Frame 9:
If (e = a)
Goto and Play (8)
Else If (e = b)
Goto and Play (8)
Else If (e = c)
Goto and Play (8)
Else If (e = d)
Goto and Play (8)
End If

This is the lazy man's way. :) The least variables you have to assign random
numbers to the better this code is, meaning it would run faster, since it
gotta compare the newly generated number with all previous ones.


Stephen


> i need to set 5 variables to random number out of 56, the thing is that
> every number should only be taken once, how do i do that? that's how far i
> got:
>
> Set Variable: "a" = (Random(56)+1)
> Set Variable: "b" = (Random(56)+1)
> Set Variable: "c" = (Random(56)+1)
> Set Variable: "d" = (Random(56)+1)
> Set Variable: "e" = (Random(56)+1)



flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
July 24-26, 2000, NEW YORK CITY, Hammerstein Ballroom
www.flashforward2000.com
Produced by United Digital Artists and lynda.com
Sponsored by Macromedia, Adobe Systems, Fusion, Inc, AtomFilms,
shockwave.com and Electric Rain.
1.877.4.FLASH.4 or (1.805.640.6679 outside the US and Canada)
Register before June 30 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: set variable randomly, numbers sh, nadia

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