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