Randomizing a function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Blurbint
    New Member
    • Nov 2006
    • 37

    #1

    Randomizing a function?

    Like if i click a button, it would be 50 % that the program ends, and 50% that form1.backcolor = qbcolor(15).
    Is that possible?
  • Andrew Thackray
    New Member
    • Oct 2006
    • 76

    #2
    use the rnd() function

    As in

    Code:
    dim x as int
    
    x = rnd() * 100
    if x => 50 then

    Comment

    • Andrew Thackray
      New Member
      • Oct 2006
      • 76

      #3
      Sorry - hit enter before I finished. The code should read

      Code:
      dim x as int
      
      x=rnd() * 100
      if x >=50 then
               Put your code to close here
      else
              Put your color change staterment here
      end if

      Comment

      Working...