storing a randomly generate number in a variable
Archiver
Posts: 46,084
Hi all, I have a set of different loops in my program(loop1: loop2: -
-- loop8[noparse]:)[/noparse], I generate two random numbers, I store them in two
variables called num1, numb2. now I want to use these random numbers
to determine which loop will be activated, but I am finding out that
I cannot have loopnum1, loopnum2. the program return num1 as
undefined variable, can anyne help me? by the way I am new to the
pbasic language.
-- loop8[noparse]:)[/noparse], I generate two random numbers, I store them in two
variables called num1, numb2. now I want to use these random numbers
to determine which loop will be activated, but I am finding out that
I cannot have loopnum1, loopnum2. the program return num1 as
undefined variable, can anyne help me? by the way I am new to the
pbasic language.
Comments
>Hi all, I have a set of different loops in my program(loop1: loop2: -
>-- loop8[noparse]:)[/noparse], I generate two random numbers, I store them in two
>variables called num1, numb2. now I want to use these random numbers
>to determine which loop will be activated, but I am finding out that
>I cannot have loopnum1, loopnum2. the program return num1 as
>undefined variable, can anyne help me? by the way I am new to the
>pbasic language.
It may well be helpful if you cut and pasted your program into a message.
This way we can see exactly what you are attempting to do. This list does
not accept attachments.
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the Subject and
>Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
of your "loops" with the random value generated elsewhere. Here's the idea:
Main:
RANDOM randWord
rnd1 = rndWord.LowNib(0) * %0111
BRANCH rnd1, [noparse][[/noparse]Loop1, Loop2, Loop3, .... ]
GOTO Main
Loop1:
' code here
GOTO Main
Loop2:
' code here
GOTO Main
-- Jon Williams
-- Applications Engineer, Parallax
In a message dated 11/23/02 9:49:26 AM Central Standard Time,
konpen@y... writes:
> Hi all, I have a set of different loops in my program(loop1: loop2: -
> -- loop8[noparse]:)[/noparse], I generate two random numbers, I store them in two
> variables called num1, numb2. now I want to use these random numbers
> to determine which loop will be activated, but I am finding out that
> I cannot have loopnum1, loopnum2. the program return num1 as
> undefined variable, can anyne help me? by the way I am new to the
>
[noparse][[/noparse]Non-text portions of this message have been removed]