Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generating Random Numbers in Visual Basic
#1
I recently watched this video
<!-- m --><a class="postlink" href="http://www.youtube.com/watch?feature=player_detailpage&v=G1reHzr3DCI">http://www.youtube.com/watch?feature=pl ... 1reHzr3DCI</a><!-- m -->

And the video shows this frmula for generating random number
(highnumber-lownumber+1) *Rnd() + lownumber

Can anybody tell me how does this formula works
I.e the logic behind this formula

Thanks in Advance!!!
The Power to Believe in Yourself is the Power to change the Fate!
#2
Well, it has to do with the formula for finding the average value of a function, where the average value is
(1 / b - a) * (a to b)(Integral(ƒ(x)). Since the Rnd() Function only generates numbers between 0 and 1, we need to multiply and add values in order to enter the range we want.
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Visual Studio Express vs Proffesional vs Ultimate Derek275 2 13,466 12-03-2012, 02:38 PM
Last Post: Derek275
  Visual Basic Game Atri 3 14,627 09-05-2012, 02:57 PM
Last Post: brandonio21
  Visual basic msgbox /Help Himansh 8 27,210 03-24-2012, 11:26 PM
Last Post: Himansh
  Visual Studio 2010 Professional LearningComputer 2 12,515 03-11-2012, 03:29 PM
Last Post: brandonio21
  Internet Explorer Functions in Visual basic Protection4Real 2 12,087 04-13-2011, 07:45 PM
Last Post: brandonio21
  VERY usefull visual basic components xolara 10 32,627 02-18-2011, 01:21 AM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)