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


TypeScript seedrandom.default函数代码示例

本文整理汇总了TypeScript中seedrandom.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

 constructor(seed : string, verbose: boolean) {
     // The generator only cares about its own seed value and its random number generator
     this.seed = seed;
     this.randGenerator = (seed != '') ? seedrandom(seed) : seedrandom();
     if (verbose) {
         this.verbose = verbose;
     } else {
         this.verbose = false
     }
 }
开发者ID:ShiJbey,项目名称:WeaponGenerator,代码行数:10,代码来源:SwordGenerator.ts

示例2: _str

    beforeEach(() => {
      rng = seedrandom('some fixed value');

      function _str(len: number) {
        let r = '';
        const space = 'abcdefghijklmnopqrstuvwxyz0123456789';
        for (let i = 0; i < len; i++) {
          r += space[Math.floor(rng() * space.length)];
        }

        return r;
      }

      // Build test cases.
      cases = new Array(numRandomIter)
        .fill(0)
        .map(() => {
          return new Array(Math.floor(rng() * 20 + 5))
            .fill(0)
            .map(() => _str(rng() * 20 + 3))
            .join('/');
        });

      resetNormalizeCache();
    });
开发者ID:DevIntent,项目名称:angular-cli,代码行数:25,代码来源:path_benchmark.ts

示例3: randomKey

export function randomKey() {
  const byteseed = new Uint8Array(32)
  for (let i = 0; i < 32; i++) {
    byteseed[i] = Math.floor(seedrandom()() *  255) + 1
  }
  const keypair = nacl.sign.keyPair.fromSeed(byteseed)
  return new Key(
    Base58encode(keypair.publicKey),
    Base58encode(keypair.secretKey)
  )
}
开发者ID:Kalmac,项目名称:duniter,代码行数:11,代码来源:keyring.ts

示例4: getParts

 private getParts(id: string, variant: string) {
   const variantParts = this._variants[variant]
   if (!variantParts) {
     throw new Error(
       `variant '${variant}' is not supported. Supported variants: ${Object.keys(
         this._variants
       )}`
     )
   }
   const rng = seedrandom(id)
   return this._parts
     .map(
       (partName: AvatarPart): string => {
         const partVariants = variantParts[partName]
         return (
           partVariants &&
           partVariants[Math.floor(rng() * partVariants.length)]
         )
       }
     )
     .filter(Boolean)
 }
开发者ID:arusanov,项目名称:avatar-generator,代码行数:22,代码来源:index.ts

示例5: function

random.seed = function(s) {
  state.rng = seedrandom(s);
};
开发者ID:zaidka,项目名称:genieacs,代码行数:3,代码来源:sandbox.ts

示例6: random

function random(): number {
  if (!state.rng) state.rng = seedrandom(state.sessionContext.deviceId);

  return state.rng();
}
开发者ID:zaidka,项目名称:genieacs,代码行数:5,代码来源:sandbox.ts


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