C语言中怎么实现随机?
using System;using System.Collections.Generic;
using System.Text;
//自已写算法插件时需要注意以下几点:
//1、文件名与命名空间、类名必须一致;
//2、共有方法getValue()和getIniValue()的返回值类型和参数类型不得修改
//3、可以增加命名空间;
//3、数据的长度为16;
//4、可以构建自己的复杂的算法,
namespace zhong91011b
{
public class zhong91011b : VoteMethod.MethodPluginInterface
{
int[] ieggs = new int[16] {1, 1, 2, 3, 5, 0, 0, 0, 0, 0, 0, 5, 3, 2, 1, 1};
int[] pv = new int[16] {200, 72, 38, 29, 14, 10, 8, 7, 7, 8, 10, 14, 23, 38, 77, 200};
int[] ieggs1 = new int[16] {1, 1, 2, 3, 5, 0, 0, 0, 0, 0, 0, 5, 3, 2, 1, 1};
int[] oeggs = new int[16] {0, 0, 0, 0, 0, 0, 8, 8,8, 0, 0, 0, 0, 0, 0, 0};
int[] oeggs1 = new int[16] {0, 0, 0, 0, 0, 0, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0};
int cetext=0;
int j=0;
public int[] getValue(int[] eggs, int code)
{
int i;
if (cetext%2 != 0)
{
if ((code <9) || (code >11))
{
for(i=0;i<16;i++)
{
eggs[i]=ieggs1[i]*2;
ieggs1[i]=ieggs1[i]*2;
oeggs1[i]=oeggs1[i]*2;
}
cetext=cetext+1;
return eggs;
}
for (i=0;i<16;i++)
{
eggs[i]=ieggs[i];
ieggs1[i]=ieggs[i];
oeggs1[i]=oeggs[i];
}
cetext=cetext+1;
}
else{
cetext=cetext+1;
if ((code >7) && (code <14))
{
for(i=0;i<16;i++)
{
eggs[i]=oeggs1[i]*2;
oeggs1[i]=oeggs1[i]*2;
ieggs1[i]=ieggs1[i]*2;
}
j=j+1;
return eggs;
}
for (i=0;i<16;i++)
{
eggs[i]=oeggs[i];
oeggs1[i]=oeggs[i];
ieggs1[i]=ieggs[i];
}
}
return eggs;
}
public int[] getIniValue()
{
return ieggs;
}
}
}
说明:这个是个自动投注的编码,两组数交替投注,不中翻倍,现在想改成两组数随机投注,不中翻倍,请大家帮忙指导,不尽感激。