chancejs / chancejs/chancejs

CLI generators not so random

Open
#142 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.5k
Forks
461
PR merge metrics
No merged PRs in 30d

Description

When running generators from the new CLI feature, they are not very random. Here is the output of calling "chance word" several times in a row:

vapik
teogefe
suvaflud
ut
gibgewuga
cim
gendadel
ate
rizjefjo
ro
cim
cof
cim
mi
gibgewuga
gibgewuga
gendadel
ut
teogefe
alogikfur

You can see "gibgewuga" is repeated 3 times, as is "cim". "gendadel" and "teogefe" are repeated twice.

It looks like this is not specific to "word", but rather systemic. Similar results occur with "chance name":

Madge Scott
Flora Vaughn
Elsie Wallace
Victoria Huff
Ricky Russell
Rodney Thornton
Bobby Swanson
Ida Carlson
Dennis Atkins
Emily Bass
Mina Sims
Bettie Quinn
James Hamilton
Esther Young
Anne Weaver
Rodney Thornton
Anne Weaver
Bernice Dunn
Lura Guzman
Curtis Norris
Jesus Kim
Jesus Kim
Bernice Dunn
Bernice Dunn
Francis Ward
Bernice Dunn
Emily Bass
Esther Young
Bettie Quinn

I haven't investigated yet, but I assume this is related to not having a true source of entropy at startup. For the CLI to be useful, I think it needs a better source of entropy. I'm sure even the CPU tick time would give better results.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the CLI commands shown in the report, `chance word` and `chance name`, and trace the generator randomness initialization at startup. Investigate why repeated calls produce duplicate values; done means the CLI uses a stronger startup entropy source and the reported systemic repetition is no longer reproducible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.