UNPKG

clustering-tfjs

Version:

High-performance TypeScript clustering algorithms (K-Means, Spectral, Agglomerative) with TensorFlow.js acceleration and scikit-learn compatibility

18 lines (17 loc) 523 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.make_random_stream = make_random_stream; const mt19937_1 = require("./mt19937"); function make_random_stream(seed) { if (seed === undefined) { return { rand: Math.random, randInt: (max) => Math.floor(Math.random() * max), }; } const engine = new mt19937_1.MT19937(seed >>> 0); return { rand: () => engine.nextFloat(), randInt: (max) => engine.nextInt(max), }; }