Results 1 to 5 of 5

Thread: PCF: MarZam 2 RNG for VB.net?

  1. #1
    PCF
    Guest

    PCF: MarZam 2 RNG for VB.net?


    Norm posted the source code of the rng from George Marsaglia and Arif Zaman more than 3 years ago on the page "Computing for Counters".
    I tried to use this code for VB.net but I couldn't get it to work. I declared Seed1 and Seed2 as Integer. But I get a error stating "index out of range exception" for
    uni = u(i97) - u(j97)
    in the first line of
    Public Function RND() As Double

    Does anybody know a solution?



  2. #2
    Norm Wattenberger
    Guest

    Norm Wattenberger: Re: MarZam 2 RNG for VB.net?

    Integer has a different meaning in VB.Net. You could try a different type. Although that's an odd error. Sure you got all the code copied correctly?

    > Norm posted the source code of the rng from George
    > Marsaglia and Arif Zaman more than 3 years ago on the
    > page "Computing for Counters".
    > I tried to use this code for VB.net but I couldn't get
    > it to work. I declared Seed1 and Seed2 as Integer. But
    > I get a error stating "index out of range
    > exception" for
    > uni = u(i97) - u(j97)
    > in the first line of
    > Public Function RND() As Double

    > Does anybody know a solution?

  3. #3
    PCF
    Guest

    PCF: Re: MarZam 2 RNG for VB.net?

    Thanks for your help. I copied the code directly from your post. The only changes I made(though the error also occurs without the changes) is that I deleted "ivec, i5 and j5" because they are not used local variables.

    I tried to declare Seed1 and Seed2 as Double or Long, I still get the Error. This VB version has an IntelliSense feature and when I move the cursor obove the i97 and j97 in the line

    uni = u(i97) - u(j97)

    it says that both variables are -1. ??

    I'm also using Windows Form Application and not the Console.

  4. #4
    Norm Wattenberger
    Guest

    Norm Wattenberger: Re: MarZam 2 RNG for VB.net?

    Well, that would happen if you called the rand routine before calling the init routine.

    > Thanks for your help. I copied the code directly from
    > your post. The only changes I made(though the error
    > also occurs without the changes) is that I deleted
    > "ivec, i5 and j5" because they are not used
    > local variables.

    > I tried to declare Seed1 and Seed2 as Double or Long,
    > I still get the Error. This VB version has an
    > IntelliSense feature and when I move the cursor obove
    > the i97 and j97 in the line

    > uni = u(i97) - u(j97)

    > it says that both variables are -1. ??

    > I'm also using Windows Form Application and not the
    > Console.

  5. #5
    PCF
    Guest

    PCF: It works now. Thank you Norm! :-) *NM*


Bookmarks

Posting Permissions

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

About Blackjack: The Forum

BJTF is an advantage player site based on the principles of comity. That is, civil and considerate behavior for the mutual benefit of all involved. The goal of advantage play is the legal extraction of funds from gaming establishments by gaining a mathematic advantage and developing the skills required to use that advantage. To maximize our success, it is important to understand that we are all on the same side. Personal conflicts simply get in the way of our goals.