Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 长种子=11L*13*17*19*23+的含义是什么;1.在上面的代码中?_Java - Fatal编程技术网

Java 长种子=11L*13*17*19*23+的含义是什么;1.在上面的代码中?

Java 长种子=11L*13*17*19*23+的含义是什么;1.在上面的代码中?,java,Java,一个演示如何使用GridSim软件包的简单程序。 *此示例显示网格用户如何提交其Gridlet或 *将任务分配给一个网格资源实体 private GridletList createGridlet(int userID) { // Creates a container to store Gridlets GridletList list = new GridletList(); // We create three Gridlets or jobs/tasks man

一个演示如何使用GridSim软件包的简单程序。 *此示例显示网格用户如何提交其Gridlet或 *将任务分配给一个网格资源实体

private GridletList createGridlet(int userID)
{
    // Creates a container to store Gridlets
    GridletList list = new GridletList();

    // We create three Gridlets or jobs/tasks manually without the help
    // of GridSimRandom
    int id = 0;
    double length = 3500.0;
    long file_size = 300;
    long output_size = 300;
    Gridlet gridlet1 = new Gridlet(id, length, file_size, output_size);
    id++;
    Gridlet gridlet2 = new Gridlet(id, 5000, 500, 500);
    id++;
    Gridlet gridlet3 = new Gridlet(id, 9000, 900, 900);

    // setting the owner of these Gridlets
    gridlet1.setUserID(userID);
    gridlet2.setUserID(userID);
    gridlet3.setUserID(userID);

    // Store the Gridlets into a list
    list.add(gridlet1);
    list.add(gridlet2);
    list.add(gridlet3);

    // We create 5 Gridlets with the help of GridSimRandom and
    // GriSimStandardPE class
    long seed = 11L*13*17*19*23+1;
    Random random = new Random(seed);

    // sets the PE MIPS Rating
    GridSimStandardPE.setRating(100);

    // creates 5 Gridlets
    int count = 5;
    for (int i = 1; i < count+1; i++)
    {
        // the Gridlet length determines from random values and the
        // current MIPS Rating for a PE
        length = GridSimStandardPE.toMIs(random.nextDouble()*50);

        // determines the Gridlet file size that varies within the range
        // 100 + (10% to 40%)
        file_size = (long) GridSimRandom.real(100, 0.10, 0.40,
                                random.nextDouble());

        // determines the Gridlet output size that varies within the range
        // 250 + (10% to 50%)
        output_size = (long) GridSimRandom.real(250, 0.10, 0.50,
                                random.nextDouble());

        // creates a new Gridlet object
        Gridlet gridlet = new Gridlet(id + i, length, file_size,
                                output_size);

        gridlet.setUserID(userID);

        // add the Gridlet into a list
        list.add(gridlet);
    }

    return list;
}
private GridletList createGridlet(int userID)
{
//创建一个容器来存储网格
GridleList=新的GridleList();
//我们在没有帮助的情况下手动创建三个Gridlet或作业/任务
//网格随机
int id=0;
双倍长度=3500.0;
长文件大小=300;
长输出_尺寸=300;
Gridlet gridlet1=新的Gridlet(id、长度、文件大小、输出大小);
id++;
Gridlet gridlet2=新的Gridlet(id,5000500500);
id++;
Gridlet gridlet3=新的Gridlet(id,900900900);
//设置这些网格的所有者
gridlet1.setUserID(userID);
gridlet2.setUserID(userID);
gridlet3.setUserID(userID);
//将网格存储到列表中
添加(gridlet1);
添加(gridlet2);
添加(gridlet3);
//我们在GridSimRandom和
//GriSimStandardPE类
长种子=11L*13*17*19*23+1;
随机随机=新随机(种子);
//设置PE MIPS分级
网格标准设置(100);
//创建5个网格
整数计数=5;
对于(int i=1;i
如果向
随机
添加种子,则每次运行代码时都会得到相同的结果。如果没有提供种子,java会自己选择一个种子(基于当前时间)。这是伪随机数生成器的一个特性。有关更详细的解释,请参见。

11,13,17,19,23是素数,计算结果为:1062348。编辑:我在帮忙!D:相关:其他人关于随机种子值可能是正确的,但请仔细阅读,当你有机会时,这似乎是试图获得“更随机”的随机种子。你选哪个号码真的不重要+1.