需求简单算法实现以下功能,请高手指点 自己先写写。可以用hashtable:键名保存生成的随机数,值就是88、8888 然后在创建带有逻辑的随机数,我的想法。没时间帮你搞啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 int[] seed = new int[1200]; int count_8888 = 0, count_888 = 0, count_88 = 0, count_8 = 0; Random r = new Random(); while (count_8888 < 40) { int index = r.Next(0, 1199); if (seed[index] == 0) { seed[index] = 8888; count_8888++; } } while (count_888 < 60) { int index = r.Next(0, 1199); if (seed[index] == 0) { seed[index] = 888; count_888++; } } 怎么将一个TreeView上的数据复制到另一个TreeView上 各位帮忙给个思路,我想写个程序自动刷页面的链接 求Tcp/IP发送大数据思路 怎样才能在程序中对数据库实现备份和恢复? 怎样在现有DataSet数据集中提取,指定范围的数据? 字符串要怎么转才能怎么支持XPATH语法 C#绘图实现光栅效果 怎么在c#中读取mib的一个表?并在listview中显示出来? 如何在WebRequest中模拟表单提交? 求用c#读写文件的示例代码! 怎么使用odbc驱动和C#语言创建dbf文件,并实现对它的读写操作 一个简单的功能,送分了!!
int[] seed = new int[1200];
int count_8888 = 0, count_888 = 0, count_88 = 0, count_8 = 0;
Random r = new Random();
while (count_8888 < 40)
{
int index = r.Next(0, 1199);
if (seed[index] == 0)
{
seed[index] = 8888;
count_8888++;
}
}
while (count_888 < 60)
{
int index = r.Next(0, 1199);
if (seed[index] == 0)
{
seed[index] = 888;
count_888++;
}
}