By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,612 Members | 1,632 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,612 IT Pros & Developers. It's quick & easy.

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

P: 1
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
Mar 11 '07 #1
Share this Question
Share on Google+
1 Reply


100+
P: 1,646
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.
Expand|Select|Wrap|Line Numbers
  1. Select Case RndNum
  2.    Case 1
  3.       z = x * y
  4.  
  5.    Case 2
  6.       z = x / y
  7.  
  8.    Case 3
  9.       z = x + y
  10.  
  11.    'etc
  12. End Select
Mar 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.