唯一随机数 [英] Unique Random Numbers
问题描述
有些人可以使用简单的唯一随机数发布代码。
存储在arr [20]中的随机数但是唯一的。
2007-03-25 16:31,Xoomer写道:
有些人可以使用简单的独特随机数发布代码。
存储在arr中的随机数[20]但独一无二。
从头到尾:
#include< cstdlib>
#包括< ctime>
int main()
{
srand(time(0));
int arr [20];
for(int i = 0; i< 20; ++ i)
arr [i] = rand();
返回0;
}
-
Erik Wikstr?m
3月25日下午3:53,Erik Wikstr?m< Erik-wikst ... @ telia.comwrote:
在2007-03-25 16:31,Xoomer写道:
有些人可以使用simpleUniqueRandomNumbers发布代码。
随机数字存储在arr [20] butunique中。
从头到尾:
#include< cstdlib>
#包括< ctime>
int main()
{
srand(time(0));
int arr [20];
for(int i = 0; i< 20; ++ i)
arr [i] = rand();
返回0;
}
-
Erik Wikstr?m
谢谢。但这个数字可能重复相同..它不是唯一的。
3月25日下午3:53,Erik Wikstr?m< Erik-wikst ... @ telia.comwrote:
2007-03-25 16:31,Xoomer写道:
您好,
有些人可以使用simpleUniqueRandomNumbers发布代码。
随机数字存储在arr [20] butunique中。
从头到尾:
#include< cstdlib>
#包括< ctime>
int main()
{
srand(time(0));
int arr [20];
for(int i = 0; i< 20; ++ i)
arr [i] = rand();
返回0;
}
-
Erik Wikstr?m
谢谢。但随机数可能重复相同..它不是唯一的。
Hi,
Can some post a code with simple Unique Random Numbers.
Random numbers stored in arr[20] but unique.
On 2007-03-25 16:31, Xoomer wrote:Hi,
Can some post a code with simple Unique Random Numbers.
Random numbers stored in arr[20] but unique.From the top of my head:
#include <cstdlib>
#include <ctime>
int main()
{
srand(time(0));
int arr[20];
for (int i = 0; i < 20; ++i)
arr[i] = rand();
return 0;
}
--
Erik Wikstr?m
On Mar 25, 3:53 pm, Erik Wikstr?m <Erik-wikst...@telia.comwrote:On 2007-03-25 16:31, Xoomer wrote:
Hi,
Can some post a code with simpleUniqueRandomNumbers.
Randomnumbersstored in arr[20] butunique.
From the top of my head:
#include <cstdlib>
#include <ctime>
int main()
{
srand(time(0));
int arr[20];
for (int i = 0; i < 20; ++i)
arr[i] = rand();
return 0;
}
--
Erik Wikstr?mThanks. But the number may repeat the same.. its not Unique.
On Mar 25, 3:53 pm, Erik Wikstr?m <Erik-wikst...@telia.comwrote:On 2007-03-25 16:31, Xoomer wrote:
Hi,
Can some post a code with simpleUniqueRandomNumbers.
Randomnumbersstored in arr[20] butunique.
From the top of my head:
#include <cstdlib>
#include <ctime>
int main()
{
srand(time(0));
int arr[20];
for (int i = 0; i < 20; ++i)
arr[i] = rand();
return 0;
}
--
Erik Wikstr?mThanks. But the random number may repeat the same.. its not Unique.
这篇关于唯一随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!