From 5317a5a90e41fd93e9a6cb596c66d6bd331de7ae Mon Sep 17 00:00:00 2001 From: Arnaud Grall Date: Thu, 16 May 2024 17:59:11 +0200 Subject: [PATCH] no issue at all; update the readme --- README.md | 23 ++++++++++++----------- tests/hyperloglog.test.ts | 13 +++++++++++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1488db9d..e9d54790 100644 --- a/README.md +++ b/README.md @@ -313,18 +313,19 @@ The HyperLogLog algorithm is able to estimate cardinalities greather than `10e9` const {HyperLogLog} = require('bloom-filters') // create a new HyperLogLog with 100 registers -const sketch = new HyperLogLog(100) - -// push some occurrences in the sketch -sketch.update('alice') -sketch.update('alice') -sketch.update('bob') - -// count occurrences -console.log(sketch.count()) +const sketch = new HyperLogLog(128) +// push 10000 distinct elements +const n = 2 ** 14 +for (let i = 0; i { expect(newFilter._correctionBias).toEqual(sketch._correctionBias) expect(newFilter._registers).toEqual(sketch._registers) }) + +test('issue#(https://github.com/Callidon/bloom-filters/issues/69)', () => { + // create a new HyperLogLog with 100 registers + const sketch = new HyperLogLog(128) + // push 10000 distinct elements + const n = 2 ** 14 + for (let i = 0; i