Results 1 to 3 of 3

Thread: [2005] why the integer value of random number is same?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Hong Kong
    Posts
    384

    [2005] why the integer value of random number is same?

    Dim value As Integer = CInt(Int((9 * Rnd()) + 0))

    it always give me the value = 6

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] why the integer value of random number is same?

    Dont use the old Randomize() function. Use the Random class
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: [2005] why the integer value of random number is same?

    vb Code:
    1. Dim myRnd As New Random
    2.  
    3. Dim myVal As Integer = myRnd.Next(1, 11)

    That will return integer values between 1 and 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