LCOV - code coverage report
Current view: top level - randomjs/distribution - dice.ts (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 1 13 7.7 %
Date: 2021-03-12 10:43:40 Functions: 0 1 0.0 %

          Line data    Source code
       1             : import { Distribution } from "../types.ts";
       2           1 : import { die } from "./die.ts";
       3             : 
       4             : /**
       5             :  * Returns a distribution that returns an array of length `dieCount` of values
       6             :  * within [1, `sideCount`]
       7             :  * @param sideCount The number of sides of each die
       8             :  * @param dieCount The number of dice
       9             :  */
      10           0 : export function dice(
      11           0 :   sideCount: number,
      12           0 :   dieCount: number
      13             : ): Distribution<number[]> {
      14           0 :   const distribution = die(sideCount);
      15           0 :   return engine => {
      16           0 :     const result = [];
      17           0 :     for (let i = 0; i < dieCount; ++i) {
      18           0 :       result.push(distribution(engine));
      19           0 :     }
      20           0 :     return result;
      21           0 :   };
      22           0 : }

Generated by: LCOV version 1.15