本文整理汇总了TypeScript中neuroglancer/util/random.getRandomValues函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getRandomValues函数的具体用法?TypeScript getRandomValues怎么用?TypeScript getRandomValues使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRandomValues函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: fragmentShaderTest
fragmentShaderTest(1, tester => {
let {gl, builder} = tester;
builder.addFragmentCode(glsl_addUint32);
builder.addUniform('highp vec4', 'uValue1');
builder.addUniform('highp vec4', 'uValue2');
builder.addOutputBuffer('vec4', 'v4f_fragData0', 0);
builder.setFragmentMain(`
uint32_t a, b; a.value = uValue1; b.value = uValue2;
v4f_fragData0 = add(a, b).value;
`);
tester.build();
let {shader} = tester;
shader.bind();
function testPair(a: number, b: number) {
let result = (a + b) >>> 0;
gl.uniform4fv(shader.uniform('uValue1'), setVec4FromUint32(vec4.create(), a));
gl.uniform4fv(shader.uniform('uValue2'), setVec4FromUint32(vec4.create(), b));
tester.execute();
let value = tester.readUint32();
expect(value).toEqual(result, `${a} + ${b}`);
}
function testPairs(values: Uint32Array) {
for (let i = 0; i < values.length; i += 2) {
testPair(values[i], values[i + 1]);
}
}
testPairs(Uint32Array.of(0, 1, 3, 2, 3, 17));
const count = 50;
testPairs(getRandomValues(new Uint32Array(count * 2)));
});
开发者ID:stephenplaza,项目名称:neuroglancer,代码行数:35,代码来源:shader_lib.spec.ts
示例2: describe
describe('random values', () => {
for (let volumeSize of [vec4.fromValues(64, 64, 64, 1), vec4.fromValues(36, 36, 36, 1), ]) {
const numElements = prod4(volumeSize);
let rawData = new Uint32Array(numElements * 2);
getRandomValues(rawData);
runTest(DataType.UINT64, volumeSize, rawData, vec888);
}
for (let volumeSize of [vec4.fromValues(13, 17, 23, 1), vec4.fromValues(13, 17, 23, 2), ]) {
const numElements = prod4(volumeSize);
{
let rawData = new Uint32Array(numElements * 2);
getRandomValues(rawData);
runTest(DataType.UINT64, volumeSize, rawData, vec888);
}
{
let rawData = new Uint32Array(numElements);
getRandomValues(rawData);
runTest(DataType.UINT32, volumeSize, rawData, vec888);
}
}
});
开发者ID:funkey,项目名称:neuroglancer,代码行数:21,代码来源:chunk_format.spec.ts
示例3: suite
suite('gpu_hash/hash_table', () => {
let ht = new HashSetUint64();
const numValues = 100;
let values = new Uint32Array(numValues * 2);
let temp = new Uint64();
getRandomValues(values);
benchmark('insert', () => {
ht.clear();
for (let i = 0, length = values.length; i < length; i += 2) {
temp.low = values[i];
temp.high = values[i + 1];
ht.add(temp);
}
});
});
开发者ID:google,项目名称:neuroglancer,代码行数:15,代码来源:hash_table.benchmark.ts
注:本文中的neuroglancer/util/random.getRandomValues函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论