UNPKG

@guaritos/tracer-engine

Version:

A highly performant and scalable multi-hop, time-aware tracer for account-based blockchain transactions, designed for off-chain risk assessment and flow analysis.

25 lines 595 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Bucket = void 0; class Bucket { constructor() { this.set = new Set(); this.arr = []; } add(item) { if (!this.set.has(item)) { this.set.add(item); this.arr.push(item); } } removeAllItem() { this.set.clear(); this.arr = []; } getRandomItem() { const index = Math.floor((this.arr.length) * Math.random()); return this.arr[index]; } } exports.Bucket = Bucket; //# sourceMappingURL=bucket.js.map