Skip to main content

A simple, proven and non-falsifiable lottery draw tool

Project description


Lotery-drawer is a simple, proven and non-falsifiable lottery draw tool.

This tool can be used to draw a lotery in a provable way. The draw is random but will always return the same result when given the same lotery datas.



  • Python >=3.6 is required to run this program
  • Install the package by running : pip install lotery-drawer --user


You can simply print on the console the result of the lotery :

  • Create your own lotery data json, and place it into the config directory for exemple.
  • Call the main file with your json path : python3 "config/dataLotery.json"
  • Then the console will output the result

You can also directly interface your program with the library :

from lotery_drawer import Drawer

drawer = Drawer()
result = drawer.draw(dataLotery)

Here an example of the lotery data json :

  "endTimestamp": 1589289392,
  "prizes": [
    {"name":  "1000 HXRO", "nb":  1},
    {"name":  "500 HXRO", "nb":  1},
    {"name":  "200 HXRO", "nb":  5},
    {"name":  "100 HXRO", "nb":  10}
  "tickets": {
    "player_a": 10,
    "player_b": 20,
    "player_c": 30,
    "player_d": 40,
    "player_e": 150
  • endTimestamp: The end date of the lotery. It is only used to generate a seed for random functions
  • prizes: A list of the prizes of the lotery. Each prize can have one or more winning tickets (nb) and have a name (name)
  • tickets: A dict of the tickets at the end of the lotery. Each element of the dict is a player, the number associated is the number of tickets in his possession.

The tool will draw as winning tickets as there is prizes, and return an array containing the usernames and the prizes won. Note that if a ticket is won, it is removed from the tickets list for the next prizes.

Here an exemple of the result when using the file config/dataLotery.json in the repository :

  {"prizeName": "1000 HXRO", "username": "player_e"}, 
  {"prizeName": "500 HXRO", "username": "player_a"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_e"}, 
  {"prizeName": "200 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_e"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}, 
  {"prizeName": "100 HXRO", "username": "player_b"}, 
  {"prizeName": "100 HXRO", "username": "player_e"}, 
  {"prizeName": "100 HXRO", "username": "player_e"}, 
  {"prizeName": "100 HXRO", "username": "player_c"}, 
  {"prizeName": "100 HXRO", "username": "player_c"}, 
  {"prizeName": "100 HXRO", "username": "player_d"}

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lotery-drawer, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size lotery_drawer-1.0.1-py3-none-any.whl (15.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size lotery-drawer-1.0.1.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page