random number generators

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • guy

    random number generators

    does anyone have good random number generator?
    the .NET one does not generate a wide enough range of values as i have to
    populate a psuedo array that has approx 500 million entries, using the .NET
    generator the same sequence eventually repeats.
    oh it has to fast too :)


  • Göran Andersson

    #2
    Re: random number generators

    Don't use the same Random object to create all the numbers. Create a new
    object after you have used it to get a certain amount of random numbers.

    There is a better random generator used to create encryption keys in the
    encryption classes. I think that it's quite a bit slower than the Random
    class, though.

    Here is a faster replacement for the Random class:



    I expect it to be repeating the pattern just as the Random class,
    though, or even more often, so you would have to create new ones at an
    interval, just as with the Random class.

    guy wrote:
    does anyone have good random number generator?
    the .NET one does not generate a wide enough range of values as i have to
    populate a psuedo array that has approx 500 million entries, using the .NET
    generator the same sequence eventually repeats.
    oh it has to fast too :)
    >
    >

    Comment

    • guy

      #3
      Re: random number generators

      many thanks Goran


      "Göran Andersson" wrote:
      Don't use the same Random object to create all the numbers. Create a new
      object after you have used it to get a certain amount of random numbers.
      >
      There is a better random generator used to create encryption keys in the
      encryption classes. I think that it's quite a bit slower than the Random
      class, though.
      >
      Here is a faster replacement for the Random class:
      >

      >
      I expect it to be repeating the pattern just as the Random class,
      though, or even more often, so you would have to create new ones at an
      interval, just as with the Random class.
      >
      guy wrote:
      does anyone have good random number generator?
      the .NET one does not generate a wide enough range of values as i have to
      populate a psuedo array that has approx 500 million entries, using the .NET
      generator the same sequence eventually repeats.
      oh it has to fast too :)
      >

      Comment

      • richard_jonas_news@hotmail.com

        #4
        Re: random number generators


        guy wrote:
        many thanks Goran
        >
        >
        "Göran Andersson" wrote:
        >
        Don't use the same Random object to create all the numbers. Create a new
        object after you have used it to get a certain amount of random numbers.

        There is a better random generator used to create encryption keys in the
        encryption classes. I think that it's quite a bit slower than the Random
        class, though.

        Here is a faster replacement for the Random class:



        I expect it to be repeating the pattern just as the Random class,
        though, or even more often, so you would have to create new ones at an
        interval, just as with the Random class.

        guy wrote:
        does anyone have good random number generator?
        the .NET one does not generate a wide enough range of values as i have to
        populate a psuedo array that has approx 500 million entries, using the .NET
        generator the same sequence eventually repeats.
        oh it has to fast too :)
        >
        >
        The "Mersenne Twister" random number generator algorithm might be what
        you need. There's some pseudocode here which you shopuld be able to
        convert to C# or VB.



        Regards

        Richard


        Comment

        Working...