Note that there are some explanatory texts on larger screens.

plurals
  1. POC#, Index was outside the bounds of the array
    primarykey
    data
    text
    <p>The exception throws at this line:</p> <pre><code>int[] list = new int[count]; //Count = 52 </code></pre> <p>The function is:</p> <pre><code>private static readonly Random _rand = new Random(); public static int[] GetList(int count) { int[] list = new int[count]; // this is line 21 for (int i = 0; i &lt; count; i++) { list[i] = i; } for (int i = 0; i &lt; count * count; i++) { int i1 = _rand.Next(count); int i2 = _rand.Next(count); if (i1 == i2) continue; //swap values list[i1] ^= list[i2]; list[i2] ^= list[i1]; list[i1] ^= list[i2]; } return list; } </code></pre> <p>Edited:</p> <blockquote> <p>It works fine for 2 months. But received this exception today. </p> <p>The program is multi-thread program. But only one thread use this class.</p> <p>It is release mode, without Visual Studio.</p> </blockquote> <p>part of the log is:</p> <blockquote> <p>Index was outside the bounds of the array. </p> <p>at iCulture.GameFramework.Util.RandomList.GetList(Int32 count) in C:\Rm716b\texasgame\TexasHoldem\trunk\iCulture.GameFramework\Util\RandomList.cs:line 21 </p> <p>at iCulture.Texas.Cards..ctor() in C:\Rm716b\texasgame\TexasHoldem\trunk\iCulture.Texas\Cards.cs:line 18 </p> <p>at iCulture.Texas.TexasGame..ctor(Player[] ParticipatePlayers, Int32 SmallBindAmount, Int32 SmallBlindPosition) in C:\Rm716b\texasgame\TexasHoldem\trunk\iCulture.Texas\TexasGame.cs:line 46 </p> </blockquote> <p>Edit:</p> <blockquote> <p>I have tried decompiling the DLL, but the code logic remains the same.</p> </blockquote> <p>It is possible hardware error cause this problem? Because it DOES NOT reappear since then.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload