当前位置: 首页>>代码示例>>Java>>正文


Java MersenneTwisterFast类代码示例

本文整理汇总了Java中org.scijava.util.MersenneTwisterFast的典型用法代码示例。如果您正苦于以下问题:Java MersenneTwisterFast类的具体用法?Java MersenneTwisterFast怎么用?Java MersenneTwisterFast使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MersenneTwisterFast类属于org.scijava.util包,在下文中一共展示了MersenneTwisterFast类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepare

import org.scijava.util.MersenneTwisterFast; //导入依赖的package包/类
@BeforeClass
public static void prepare() {
	final StringBuilder sb = new StringBuilder(10 * 1024 * 1024);
	for (int i = 0; i < 1023; i++) {
		sb.append(String.format("%09d,", i));
	}
	sb.append(String.format("%08d\r\n", 1023));
	final MersenneTwisterFast r = new MersenneTwisterFast();
	for (int i = 0; i < 1023; i++) {
		for (int j = 0; j < 1023; j++) {
			sb.append(String.format("%.7f,", r.nextFloat()));
		}
		sb.append(String.format("%.6f\r\n", r.nextFloat()));
	}
	final ByteArrayHandle bah = new ByteArrayHandle(sb.toString().getBytes());
	ctx.getService(LocationService.class).mapFile("large.csv", bah);
}
 
开发者ID:imagej,项目名称:imagej-server,代码行数:18,代码来源:DefaultTableIOPluginBenchmark.java

示例2: TestModuleItem

import org.scijava.util.MersenneTwisterFast; //导入依赖的package包/类
public TestModuleItem(final Class<T> type) {
	super(null);
	this.type = type;

	final MersenneTwisterFast r = new MersenneTwisterFast();
	required = r.nextBoolean();

	// generate a random description
	final StringBuilder sb = new StringBuilder();
	final int length = r.nextInt(10) + 5;
	for (int i = 0; i < length; i++) {
		sb.append('A' + r.nextInt(26));
	}
	description = sb.toString();
}
 
开发者ID:imagej,项目名称:imagej-omero,代码行数:16,代码来源:OMEROServiceTest.java

示例3: testProgressDialog

import org.scijava.util.MersenneTwisterFast; //导入依赖的package包/类
protected static void testProgressDialog() {
	int count = 35;
	int minSize = 8192;
	int maxSize = 65536;
	int minChunk = 256;
	int maxChunk = 16384;

	MersenneTwisterFast random = new MersenneTwisterFast();

	ProgressDialog progress = new ProgressDialog(null);

	progress.setTitle("Hello");

	int totalSize = 0;
	int totalCurrent = 0;
	int[] sizes = new int[count];
	for (int i = 0; i < count; i++) {
		sizes[i] = minSize + random.nextInt(maxSize - minSize);
		totalSize += sizes[i];
	}

	for (int i = 0; i < count; i++) {
		int current = 0;
		String item = "Item " + i + "/" + sizes[i];
		progress.addItem(item);
		while (current < sizes[i]) {
			int byteCount = minChunk + random.nextInt(maxChunk - minChunk);
			current += byteCount;
			progress.setItemCount(current, sizes[i]);
			totalCurrent += byteCount;
			progress.setCount(totalCurrent, totalSize);
			int millis = random.nextInt(500);
			if (millis > 0) try {
				Thread.sleep(millis);
			} catch (InterruptedException e) {
				// we've been asked to stop
				progress.done();
				return;
			}
		}
		progress.itemDone(item);
	}
	progress.done();
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:45,代码来源:UpdaterGUITest.java


注:本文中的org.scijava.util.MersenneTwisterFast类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。