home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,817 of 10,840   
   Auric__ to Antony Clements   
   Re: Weird   
   05 Jan 10 16:19:16   
   
   From: not.my.real@email.address   
      
   On Wed, 16 Dec 2009 08:24:28 GMT, Antony Clements wrote:   
      
   > I'm a heavy user of VB6 and according to the MSDN documentation I have   
   > for VB6, the following line of code:   
   >   
   >     a = Int((15 - 5 + 1) * Rnd + 5)   
   >   
   > Should return an integer no less than 5, and no more than 15... Which is   
   > does... when running in IDE. When compiled the above line occasionally   
   > returns a 4 as the lower limit when clearly the lower limit is 5. I've   
   > tried compensating for this by using the line:   
   >   
   >     If a < 5 Then: a = 5   
   >   
   > To no avail, there's something that i'm missing... it's probably   
   > something small and trivial and easily overlooked, any suggestions? If   
   > there is nothing wrong with those two lines of code then I shall have to   
   > dig further into the code base.   
      
   In addition to Jan's suggestions, you could also add an assert:   
     Debug.Assert (a > 4)   
      
   While running in the IDE (*only*), if a <= 4 execution will stop with an   
   error.   
      
   --   
   I suppose next, you'll be telling us   
   humans aren't descended from space aliens.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca