random function in VB
Results 1 to 6 of 6

Thread: random function in VB

  1. #1
    Junior Member
    Join Date
    Mar 2003
    Posts
    10

    Exclamation random function in VB

    I am developing a project in VB and I thought it would be nice idea to have some sort of animation which would poke out from everwhere RANDOMLY.

    I am looking for a function like the one in C++ that's called rand()

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Posts
    315
    xtremebuster you can do something like the following to create your random numbers.

    Dim theRandomNumber 'declare theRandomNumber

    Randomize 'needed to creat the random number

    theRandomNumber = Int((8 * Rnd) + 1) 'creates a random integer between 1 to 8

    Note that Rnd does the randomizing. I hope that helps.

    P.S- Your post is in the wrong forum.

    Guidance...
    - The mind is too beautiful to waste...
    Cutty


  3. #3
    Banned
    Join Date
    Aug 2001
    Location
    Yes
    Posts
    4,424
    *Moved from Tutorials*

  4. #4
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    i like to use the timer for the "Randomize" seed...

    Code:
    Randomize Timer
    maybe use a timer control, set the timer duration to a random number + 5000...
    yeah, I\'m gonna need that by friday...

  5. #5
    Junior Member
    Join Date
    Mar 2003
    Posts
    10
    Thanx Cutty and tampabay420.
    I'll be giving a try to both the methods explained.

  6. #6
    Senior Member
    Join Date
    May 2002
    Posts
    344
    I thought it would be nice idea to have some sort of animation which would poke out from everwhere RANDOMLY
    err...you also have to think about what the user would like. I certainly wouldnt like some bunny hopping randomly over my text while i am trying to type in values. Anyways, if you are the user, then do whatever you want, but if this is for a job, your boss will be mad
    Support your right to arm bears.


    ^^This was the first video game which i played on an old win3.1 box

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •