Example #1
0
 protected _compute(x: number): number {
   switch (this.distribution) {
     case "uniform":
       return x + this.mean + (bokeh_math.random() - 0.5)*this.width
     case "normal":
       return x + bokeh_math.rnorm(this.mean, this.width)
   }
 }
Example #2
0
  compute(x, use_synthetic = true) {
    if (((this.range != null ? this.range.synthetic : undefined) != null) && use_synthetic) {
      x = this.range.synthetic(x);
    }
    if (this.distribution === 'uniform') {
      return(x + this.mean + ((bokeh_math.random() - 0.5) * this.width));
    }

    if (this.distribution === 'normal') {
      return(x + bokeh_math.rnorm(this.mean, this.width));
    }
  }