random shuffle operation
<p>i have following code</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
using namespace std;


int main()
{    
    int a[] = {2, 1, 4, 3, 5, 6, 7, 9, 8, 10, 11};
    int n = sizeof(a) / sizeof(int);
    int k=0;

    for (int i = 0; i &lt; n; i++)
    {
        k = i + rand() % (n-1-i);
        int s = a[i];
        a[i] = a[k];
        a[k] = s;     
    }

    for (int i = 0; i &lt; n; i++)
    {     
        cout &lt;&lt; a[i] &lt;&lt; "  " &lt;&lt; endl;
    }

    return 0;
}
</code></pre>

<p>but it gives me runtime error,i know there is a lot of method in internet ,just i choose such simple for exam preparation in university,please help me what is wrong?</p>
