Generaterandom numbers with equal probability
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Generaterandom numbers with equal probability

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Posts
    1

    Unhappy Generaterandom numbers with equal probability

    Dear all,
    I wanna to generate numbers -in range- with equal probability.
    So I have minimum value and maximum value and number of generate numbers and return array of numbers, like this:

    Code:
    public long[] doGenerate(int min, int max, int total)
    {
      return ret[];
    }
    Thank you.

  2. #2
    Join Date
    May 2009
    Posts
    2,413

    Re: Generaterandom numbers with equal probability

    Quote Originally Posted by shakatreh View Post
    I wanna to generate numbers -in range- with equal probability.
    So I have minimum value and maximum value and number of generate numbers and return array of numbers, like this:
    Use the Random class. Search the net for info on usage.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center