當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。