Results 1 to 4 of 4

Thread: Random Number Generator

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,963

    Random Number Generator

    There seems to be no documentation on how to generate random numbers as easily as in VB6. The following generates a different sequence of number(s) in the range 0 to 45 each time it is invoked, even if the project is re-started (which is where several generators fall down).

    VB Code:
    1. Dim rnd As New Random (Form or Global scope NOT local)
    2.  
    3. TextBox1.Text = rnd.Next(45).ToString
    Last edited by taxes; Aug 30th, 2005 at 05:29 AM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  2. #2
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: Random Number Generator

    Quote Originally Posted by taxes
    There seems to be no documentation on how to generate random numbers as easily as in VB6.
    The System.Random class seems well documented to me. What's your exact problem?
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Arrow Re: Random Number Generator

    Quote Originally Posted by ntg
    The System.Random class seems well documented to me. What's your exact problem?
    I was thinking the same. Anyway I had this covered in this thread...
    http://www.vbforums.com/showthread.php?t=332527

    Last edited by wossname; Apr 20th, 2005 at 02:15 PM.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,963

    Re: Random Number Generator

    Quote Originally Posted by ntg
    The System.Random class seems well documented to me. What's your exact problem?
    I have no problem with it. This is not a problem post. I put this in the code bank because there are dozens of posts on the subject, most of which end up NOT generating random numbers at all. Look some of them up and you will see what I mean. It may be easy to you but it obviously isn't to many others. We should not really be having this discussion in the codebank section. Either start a new thread or use the private message system.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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