How to use the d3-random.randomUniform function in d3-random

To help you get started, we’ve selected a few d3-random examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / d3-random / d3-random-tests.ts View on Github external
*/

import * as d3Random from 'd3-random';


// ------------------------------------------------------------
// Preparatory Steps
// ------------------------------------------------------------

let randomNumberGenerator: () => number;

// ------------------------------------------------------------
// randomUniform
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomUniform();
randomNumberGenerator = d3Random.randomUniform(0.2);
randomNumberGenerator = d3Random.randomUniform(0.2, 5);

// ------------------------------------------------------------
// randomNormal
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomNormal();
randomNumberGenerator = d3Random.randomNormal(3);
randomNumberGenerator = d3Random.randomNormal(3, 4);

// ------------------------------------------------------------
// randomLogNormal
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomLogNormal();
github DefinitelyTyped / DefinitelyTyped / d3-random / d3-random-tests.ts View on Github external
import * as d3Random from 'd3-random';


// ------------------------------------------------------------
// Preparatory Steps
// ------------------------------------------------------------

let randomNumberGenerator: () => number;

// ------------------------------------------------------------
// randomUniform
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomUniform();
randomNumberGenerator = d3Random.randomUniform(0.2);
randomNumberGenerator = d3Random.randomUniform(0.2, 5);

// ------------------------------------------------------------
// randomNormal
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomNormal();
randomNumberGenerator = d3Random.randomNormal(3);
randomNumberGenerator = d3Random.randomNormal(3, 4);

// ------------------------------------------------------------
// randomLogNormal
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomLogNormal();
randomNumberGenerator = d3Random.randomLogNormal(3);
github DefinitelyTyped / DefinitelyTyped / d3-random / d3-random-tests.ts View on Github external
import * as d3Random from 'd3-random';


// ------------------------------------------------------------
// Preparatory Steps
// ------------------------------------------------------------

let randomNumberGenerator: () => number;

// ------------------------------------------------------------
// randomUniform
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomUniform();
randomNumberGenerator = d3Random.randomUniform(0.2);
randomNumberGenerator = d3Random.randomUniform(0.2, 5);

// ------------------------------------------------------------
// randomNormal
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomNormal();
randomNumberGenerator = d3Random.randomNormal(3);
randomNumberGenerator = d3Random.randomNormal(3, 4);

// ------------------------------------------------------------
// randomLogNormal
// ------------------------------------------------------------

randomNumberGenerator = d3Random.randomLogNormal();
randomNumberGenerator = d3Random.randomLogNormal(3);
randomNumberGenerator = d3Random.randomLogNormal(3, 4);
github tkh44 / data-driven-motion / demo / src / demos / Scatterplot.js View on Github external
// Inspired by https://bl.ocks.org/mbostock/4060954
import React, { Component, PureComponent } from 'react'
import { Motion } from '../../../src'
import Demo from '../Demo'
import { scaleLinear } from 'd3-scale'
import { min, max } from 'd3-array'
import { randomUniform } from 'd3-random'
const WOBBLY_SPRING = { stiffness: 60, damping: 15 }

const radiusGenerator = randomUniform(2, 8)
function randomRadius () {
  return radiusGenerator()
}

const width = 800
const height = 450

class Scatterplot extends PureComponent {
  render () {
    const { points } = this.props
    const maxY = max(points, d => d[1])
    const minY = min(points, d => d[1])
    const maxX = max(points, d => d[0])
    const xScale = scaleLinear().domain([0, maxX]).range([0, width])
    const yScale = scaleLinear().domain([minY, maxY]).range([height, 0])
github salesforce / refocus-ldk / src / Random.js View on Github external
static randomLatitude() {
    return d3r.randomUniform(-90, 90)();
  } // randomLatitude
github salesforce / refocus-ldk / src / Random.js View on Github external
static intBetween(min, max) {
    return Math.round(d3r.randomUniform(min, max)());
  } // intBetween
github salesforce / refocus-ldk / src / Random.js View on Github external
static randomLongitude() {
    return d3r.randomUniform(-180, 180)();
  }  // randomLongitude
github tkh44 / data-driven-motion / demo / src / demos / Scatterplot.js View on Github external
() => {
        return this.setState({ points: this.generateLayers(randomUniform(1, 500)() | 0) })
      },
      1000
github tkh44 / data-driven-motion / demo / src / demos / Scatterplot.js View on Github external
  getKey = (data, i) => i + '-' + (randomUniform(1, 2)() | 0);
github elastic / elastic-charts / src / utils / data_generators / randomizers.ts View on Github external
export const uniformRandomizer = (amplitude: number) => (value: number) => {
  return value + randomUniform(-amplitude / 2, amplitude / 2)();
};