how to use generate random numbers

Reply

Join Date: Jul 2007
Posts: 7
Reputation: long_vn is an unknown quantity at this point 
Solved Threads: 0
long_vn long_vn is offline Offline
Newbie Poster

how to use generate random numbers

 
0
  #1
Aug 8th, 2007
Dear all
i have to do the exercise. The check boxes have 5 items: item 1, item2,..., item 5. Each item have one value. These values is in the range from 500 to 600.
There are 5 variables x, y, z, p, q.
The connstant number is 1800
When 3 items are checked, such as item 1 item 2, item 3, the program will generate x,y,z. And
item 1 * x+ item2*y+item3*z=1800
The same if 4 and 5 items are checked.
If 1 or 2 items are checked, the program will alert error.

I cannot do this exercise. I am waiting for anyone's help.
Thanks alot.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: how to use generate random numbers

 
0
  #2
Aug 8th, 2007
Hi,

u want a Random Number generator or logic to solve the Algebric Expression..?
not very clear with ur question..

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 7
Reputation: long_vn is an unknown quantity at this point 
Solved Threads: 0
long_vn long_vn is offline Offline
Newbie Poster

Re: how to use generate random numbers

 
0
  #3
Aug 9th, 2007
Firstly, I want to generate random numbers for items ( 1 to 5). they are in the range (500-600)
secondly, to solve the Algebric Expression.
Please hlep me.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: how to use generate random numbers

 
0
  #4
Aug 9th, 2007
Hi,

To get random numbers, first Create a Function:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Function Rand(ByVal Low As Long, _
  2. ByVal High As Long) As Long
  3. Rand = Int((High - Low + 1) * Rnd) + Low
  4. End Function

To Get five numbers,

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. dim N1,N2,N3,N4,N5 as long
  2. N1 = Rand(500, 600)
  3. N2 = Rand(500, 600)
  4. N3 = Rand(500, 600)
  5. N4 = Rand(500, 600)
  6. N5 = Rand(500, 600)
  7. '
  8. Randomize
  9. '

after this, it would be easy to solve the expression...

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 7
Reputation: long_vn is an unknown quantity at this point 
Solved Threads: 0
long_vn long_vn is offline Offline
Newbie Poster

Re: how to use generate random numbers

 
0
  #5
Aug 9th, 2007
Thanks you very much.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC