Results 1 to 3 of 3

Thread: Random Number

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    10

    Post

    Hello,

    I am making a program that involves a random number selection. When you Press a cmdButton, it would randomly select a number in between 0-9. Any suggestions on a short code?



    ------------------
    - M e n S h e n
    Canabatech Programmer

    Homepage http://influx.virtualave.net
    Email essex@seedesigns.com
    ICQ 17527422



  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Const nLowerBound = 0
    Const nUpperBound = 9
    Randomize
    MsgBox Int((nUpperBound - nLowerBound + 1) * Rnd + nLowerBound)


    ------------------
    Marty
    COGITO EGGO SUM
    I think; therefore I am a waffle.

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    I would do it :

    RandomNumber= CInt(rnd()*10)


Posting Permissions

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



Click Here to Expand Forum to Full Width