Skip to content

Numbers Dictionary does not respect seed #64

Description

@obaqueiro-primetrust

The following code taken from the NumberDictionary example with an added seed: 0 will return different 3 digits when run at different times. This means that, although the generator is stable within the same run, the NumberDictionary.generate call introduces some kind of randomness that is not ruled by the seed:

const { uniqueNamesGenerator, NumberDictionary } = require('unique-names-generator');

const numberDictionary = NumberDictionary.generate({ min: 100, max: 999 });
const characterName = uniqueNamesGenerator({
dictionaries: [['Dangerous'], ['Snake'], numberDictionary],
  length: 3,
  separator: '',
  style: 'capital',
  seed: 0,
}); 

characterName

Copy and paste this code to a node interactive session, then exit the session, enter again and run it again. The characterName is the same except for the numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions