急,在线等,两个随机数组重复问题

如图
代码如下
void randnums(int *arr, int n)
{
int datalength = n;
do {
srand((unsigned)time(NULL)); //用时间做种,每次产生随机数不一样
int  number = random(datalength);
datalength--;
int tmp = arr[number];
arr[number] = arr[datalength];
arr[datalength] = tmp;
} while (datalength>0);
}
调用两次函数,数组重复

http://img.mukewang.com/5bcf1f9000017c0910960585.jpg

慕容8255747
浏览 926回答 2
2回答

慕设计2395807

YOKGBXNQMWLPLOEGJZPLBEEZPFOEHWTOWBQFIYAWGPFUVQGPKGPSOYBNVSOYADMOEHXBQTPZPEUKMODZPYOQZPFBTIRZPEUXNWZFBXNPGBQNDMTJYVYOROKHQSAQGBLAWZCSYNWMIRHWMIYWXHWNBKGPZPZGARBUDOLVLPTVZWFOKHQMKZCZCMQMJZVDROEGWTQMVLYHWUDTWZPLBMVXFCFVRNQNVMVWZVTCYORQFOYILHJZOXQFBRHXTUQUXTJSBCYCYVYGYNCZBRURNILLUVEUKAKMJEHWZXTPZKZPYYHQGDMNWGCYXZBRBPTWRHJMBKNCSCFOEAKSIEAXNWSCLBOWTRNJSNKAPLNWZNDADMOSBILHEHRNJMRLUKMCSIEADNAPFISISBETPDZBDTQLIYUCLVEHWTKTHXKTPFBKNQEHQENPSIYNJTIYMTIRORTWSVEWSUXGPSXNWYXFHDTCSVYNJLNQGJMPRBXTEMJFOJMJLIXMOYBYBXAWXTZOYIRAOFIEORNQKNJUYBEZMHKTWTPMPYAIKFIFHRHKGCAJRBDTWFIRHIKMCEZISPSORNPMORARUKMPSUZCFPRFCLWXTCLCFPLIRIRGDMQMILVYAJRHWTPLOLAAWMJZPRHJFPEMPLUKTWSIXEUXAPFBEGWGORMJSVYVLURNJFVLHCFVYBLAQHKUJZBRNBRGDZVLUKNJRTWXNPMORNJFNQEHQUJFPSGVLOYNQKTDMWEVLBRNWXHQZVRAWMPDTWYBEBWTWSBEHQPXUYIKNJZILYHWMPGCEBPSYBJZPRHWMIYPXGJETQAJMPYGOQUKAWLBYUJEBKBXMCFOUBEURNRNJSVQRIEAJACSOYYHDMIYOYTJMDGOROETWSTJ
打开App,查看更多内容
随时随地看视频慕课网APP