Results 1 to 3 of 3

Thread: [RESOLVED] random number between 10 to 280 in text1?

  1. #1

    Thread Starter
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Resolved [RESOLVED] random number between 10 to 280 in text1?

    how do I generate a random number between 10 - 280 in text1?
    I know I can do this
    h Code:
    1. Public Function RndNumber() As String
    2. Randomize
    3. RndNumber = Int(Rnd * 280)
    4. End Function

    but how do I stop 1 2 3 4 5 6 7 8 9 from coming up?
    Live life to the fullest!!

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: random number between 10 to 280 in text1?

    Like this:
    Code:
    RndNumber = Int(Rnd * ((280-10) + 1)) + 10
    The +1 is because Rnd returns a number less than 1

  3. #3

    Thread Starter
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Re: random number between 10 to 280 in text1?

    thnak you that did it!!! I learn some thing every day
    Live life to the fullest!!

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