Sign in to follow this  
Followers 0
PoopDeck

Switch and Random Help

6 posts in this topic

Switch $choice = Random(0, 2, 1)

I tried this multiple times in many differen't situations, and used consolewrite and $choice doesn't come up at all

Is this possible?

at first it was working, with Random(0, 1, 1) i was getting 0 and 1 but with this i get nothing.

Here is an example:

Local $choice
For $i = 10 to 1 step -1
    
    Switch $choice = Random(0, 2, 1)
        
        Case $choice = 0
        
            Consolewrite($choice)
            
        Case $choice = 1

            Consolewrite($choice)
            
        Case $choice = 2

            Consolewrite($choice)
            
    EndSwitch
        
Next

I don't know what i'm doing wrong, any help is appreciated.

Share this post


Link to post
Share on other sites



For $i = 10 To 1 Step - 1
    $choice = Random(0, 2, 1)
    Switch $choice
        Case $choice = 0
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 1
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 2
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
    EndSwitch
    ConsoleWrite(@TAB & "CHOICE BRU: " & $choice & @CRLF)
Next

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Nope, backstabbed version didn't work let me try yours brett

Edited by PoopDeck

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

For $i = 10 To 1 Step - 1
    $choice = Random(0, 2, 1)
    Switch $choice
        Case $choice = 0
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 1
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
        Case $choice = 2
            ConsoleWrite(@TAB & "CHOICE WAS: " & $choice & @CRLF)
    EndSwitch
    ConsoleWrite(@TAB & "CHOICE BRU: " & $choice & @CRLF)
Next

That worked, Oddly enough i tried putting the $choice = Random(0, 2, 1) before switch and then Switch $choice but it didn't work before.

It works now though. Thanks.

... and stop editing your post backstabbed lol.. ;)

Edited by PoopDeck

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0