import math from 'mathjs';
import {Sample} from './Sampler.js'
import {jStat} from 'jstat'

export var Sampler = {
  sample({hits, total}, n) {
    // This treats your entry as a prior, and assumes you are 2 times more confident than
    // a raw beta would be. This gives your distribution more of a peak for small numbers.
    return { values: Sample(n, () => jStat.beta.sample(2*hits, 2*(total-hits))) }
  }
}


@@ -4,90 +4,39 @@
 ort 
-math from 'mathjs';%0Aimport %7BSample%7D from './Sampler.js'%0Aimport %7BjStat%7D from 'jstat
+%7Bsimulate%7D from './Simulator.js
 '%0A%0Ae
@@ -282,60 +282,35 @@
 urn 
-%7B values: Sample(n, () =%3E jStat.beta.sample(
+simulate(%60beta($%7B
 2*hits
-, 
+%7D,$%7B
 2*(t
@@ -323,12 +323,19 @@
 its)
-)) %7D
+%7D)%60, %5B%5D, n)
 %0A  %7D

Fix beta with new sampling logic.