Randomize operators such as ( *, /, +, -)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VBSTUDENT
    New Member
    • Mar 2007
    • 1

    Randomize operators such as ( *, /, +, -)

    I am just wondering if there is a way to randomize the aritmetic operators in code, I know how to randomize numbers but I am not sure if it is possible to randomize operators.

    Any help would be appreciated

    Thanks
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by VBSTUDENT
    I am just wondering if there is a way to randomize the aritmetic operators in code, I know how to randomize numbers but I am not sure if it is possible to randomize operators.

    Any help would be appreciated

    Thanks
    Hi. It is possible to randomize anything. Put the operators in a select case statement and use a random number as the case.
    Code:
    Select Case RndNum
       Case 1
          z = x * y
    
       Case 2
          z = x / y
    
       Case 3
          z = x + y
       
       'etc
    End Select

    Comment

    Working...