Hi people,
I am trying to shuffle an array of integers and the function definition I came up with is as follows:
It gives me the line : "Shuffling cards.... ....:"
But then there is a 'Bus error : 10'
Could anyone help me please?
Thanks
I am trying to shuffle an array of integers and the function definition I came up with is as follows:
Code:
void shuffle (int array[], int & size)
{
cout << "\nShuffling cards.... ....\n";
for (int i = 0; i < size; i++)
{
int random = abs(rand()/size);
swap (array[i], array[random]);
}
cout<<"\n cards shuffled \n";
}
It gives me the line : "Shuffling cards.... ....:"
But then there is a 'Bus error : 10'
Could anyone help me please?
Thanks