62,047
社区成员
发帖
与我相关
我的任务
分享
void Main()
{
for(int i=0;i<100;i++)
{
Console.WriteLine(Guid.NewGuid().ToString().Replace("-","").Substring(0,6));
}
}
void Main()
{
for(int i=0;i<100;i++)
{
//加一个随机6-10的数字
Random ran=new Random();
int len=ran.Next(6,10);
Console.WriteLine(Guid.NewGuid().ToString().Replace("-","").Substring(0,len));
}
}
int[] iarr = new int[100];
ArrayList arrlist = new ArrayList();
Random rnd = new Random();
while (arrlist.Count <= 100)
{
int num = rnd.Next(100000, int.MaxValue);
if (!arrlist.Contains(num))
{
arrlist.Add(num + " ");
}
}
for (int i = 0; i < 100; i++)
{
Console.Write(arrlist[i]);
}
private static char[] constant_justNumber ={ '0','1','2','3','4','5','6','7','8','9'};
/// <summary>
/// 生成随机数
/// </summary>
/// <param name="Length"></param>
/// <param name="Count"></param>
/// <param name="hasBig"></param>
/// <returns></returns>
public static string[] GenerateRandom(int Length, int Count)
{
int myLength = constant_justNumber.Length;
char[] constant = new char[myLength];
string[] myOutArr = new string[Count];
System.Text.StringBuilder newRandom = new System.Text.StringBuilder(constant.Length);
Random rd = new Random();
for (int j = 0; j < Count; j++)
{
for (int i = 0; i < Length; i++)
{
newRandom.Append(constant[rd.Next(constant.Length)]);
}
myOutArr[j] = newRandom.ToString();
newRandom.Remove(0, Length);
}
return myOutArr;
}
protected void Button1_Click(object sender, EventArgs e)
string[] myArr = GenerateRandom(10, 100);
int h = 0;
foreach (string w in myArr)
{
h++;
Response.Write(w + "<br/>");
}
Response.End();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Random rd = new Random();
List<int> list = new List<int>();
for (int i = 0; i < 1000; i++)
{
if (list.Count < 101)
{
int result = rd.Next(100000, 999999999);
for (int j = 0; j < list.Count; j++)
{
if (list[j] == result)
{
list.Remove(result);
}
}
list.Add(result);
}
else
{
break;
}
}
foreach (int i in list)
{
Console.WriteLine(i);
}
}
}
}
void Main()
{
Random rd=new Random();
for(int i=0;i<100;i++)
{
Console.WriteLine(rd.Next(100000,999999999).ToString());
}
}
/*
612809168
307026325
238081079
835900550
58182993
968161134
865417802
91417747
359756267
669914075
476542297
140429046
73965256
335856911
150959830
489977153
707831345
857504989
418352885
46806794
883680
924778950
936652240
67844623
797614593
34880721
959088475
281230786
253769050
557078969
952499867
127289537
98133238
242658759
215979328
259152563
889214270
285335260
383666935
230718403
416753301
51368580
360718244
168791762
864311800
858096752
205983516
155920300
543153219
841802429
345607692
708887622
967286605
461155477
31978985
688030216
370374084
170336455
38385956
23402272
9172659
584287016
837648696
802677297
717414207
349352759
42395808
831306495
119977583
891807266
600762881
422596084
473938053
187734481
630053492
949515098
564160706
767960478
203532822
939517840
828897204
803268175
738077565
411966620
211571277
243712244
160002931
636977760
210779774
527949110
888778477
718977814
247049304
360364663
221645743
832466283
213719883
558040946
451377553
515059040
*/
void Main()
{
for(int i=0;i<100;i++)
{
Console.WriteLine(Guid.NewGuid().ToString().Replace("-","").Substring(0,6));
}
}
/*
108efe
d7df9b
a1ce80
6edaaf
68bc2c
e3e5cb
f9754c
525dbd
ef71dd
fe4d99
fc493b
967fed
ee3dca
29a83f
f954ed
3213bd
08967a
61bce0
220ff0
2adda3
a28526
3c9005
1d31d9
17a6c7
a9c88e
fc5f50
7460a6
499919
4b7cfe
59e4fd
4ded30
afbfbb
79be83
af3b7e
b3ed20
0f5696
82e573
3d9911
2e489a
b708b2
4c6b62
5c7a03
6082b5
ccd0dd
f40410
aff068
946d07
2bb6e0
dfc234
35bc51
ee96f7
1b5448
1c0f8e
71eeef
b3184c
613b8e
2ed09c
7f2e82
77459d
1445b9
713440
eef8a1
2b5047
0de640
5f7700
ebd258
aedfbc
ecfaca
08fe4d
87efeb
e8e800
55f2e7
2d8730
c9eb03
66b69d
85126a
c43162
bbfaea
12dbe0
ee1c17
b51d42
0bfd0c
d57fb6
439f80
096b98
3e6130
bd64f7
f60560
43a601
b2f192
551229
f395e5
a94ee8
6ff113
464696
cd4c08
5a4a1f
d273d0
e46a69
d4bfea
*/