Skip to content

Generate fun, unique pseudorandom ID's with an animal theme!

License

Notifications You must be signed in to change notification settings

alex-dr/animalid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Animal ID

Generate fun, unique animal ID's for your projects!

Tired of boring, lame, untypeable and hard-to-remember randomly generated ID's?
Be bored no more with animalid, the latest and greatest in pseudorandom animal technology!

Add animalid to your project today and enjoy all these great features:

  • Pseudorandom animal ID's!
  • Statistics!

Installing

Installation is easy!

Simply run

pip install -e [email protected]:alex-dr/animalid.git@origin/master#egg=animalid

Or clone this repository and run

pip install .

Or put this line in your requirements.txt:

-e git://github.com/alex-dr/animalid.git@origin/master#egg=animalid

Usage

animalid is easy to use!

After adding animalid to your setup.py or requirements.txt file for your project, generate fun, unique animal-based pseudo-random ID's like this:

from animalid.random_id import generate_animal_id


def great_awesome_code(fun_parameters):
    """Informative, pep257-compliant docstring!"""
    do_neat_things()
    cool_animal_id = generate_animal_id()
    spectacularly_successful_result = do_things_with(cool_animal_id)

Randomness

Statistics about the probability of collisions, expected numbers of collisions, and more, see the animalid.probability module.

from animalid.probability import print_collision_probabilities


print_collision_probabilities()

Keys will be randomly drawn from the keyspace using the builtin random library (random.choice()).

Effort should be made to ensure that the keyspace is uniform, that is, no ID is more likely to be chosen than any other.

Right now the keyspace size is just over two billion.
When it comes to preventing ID collisions, this is not a large number.
We should expect at least one collision in about 70,000 trials, which takes about 110 ms to generate on my laptop.

ID Length

Right now, ID's are guaranteed to be at most 62 characters in length.

Development

Want to contribute to animalid?
Great!
Just fork this repository, make your changes, test them out, and then submit a pull request!

Don't forget to add awesome unit tests and follow existing guidelines

Testing

To test your changes, you're going to want to install the test dependencies.
Simply run

pip install --editable .[testing]
pytest
pydocstyle

ASCII Art

Please contribute original ASCII art to illustrate your favorite animal ID's!

><(((v(*>

weird_lumber_goatfish

About

Generate fun, unique pseudorandom ID's with an animal theme!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages