作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
一个演示如何使用 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;
}
最佳答案
如果将种子添加到 Random
,每次运行代码时都会得到相同的结果。如果没有提供种子,java 会自己选择一个种子(基于当前时间)。这是伪随机数生成器的一个特点。参见 Java Random Numbers Using a Seed以获得更详尽的解释。
关于java - long seed = 11L*13*17*19*23+1是什么意思;在上面的代码中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34740648/
我认为这应该不是一个大问题,但我自己找不到解决方案。一如既往:p 我有一个 UIWebView,其背景颜色设置为clearColor,但是当我尝试向下滚动太多时,我会在加载的 HTML 上方看到深灰色
我注意到,每当我重新安装我的应用程序时,IdentifierForVendor 都会不断变化。有没有办法让我的设备拥有相同的标识符?问题是,我需要确保标识符相同,因为我有一个备份系统,即使在删除并重新
一切都在标题中。 我有一个带有单元格的 UITableView。 cells 有一个Shadow (self.layer.shadow...)。 问题是一个单元格的阴影重叠上方的单元格。我怎样才能防止
我正在尝试创建一个切换开关,您可以在其中点击一侧,然后背景会滑过以使该侧“处于事件状态”。 为了适应可变宽度,我使用 display: table 设置了切换的两侧。这很好用。然后,我将第三个 div
我是一名优秀的程序员,十分优秀!