Skip to main content

A simple, proven and non-falsifiable lottery draw tool

Project description

lotery-drawer

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.

Documentation

Installation

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

Usage

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 main.py "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.

Source Distribution

lotery-drawer-1.0.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

lotery_drawer-1.0.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file lotery-drawer-1.0.1.tar.gz.

File metadata

  • Download URL: lotery-drawer-1.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for lotery-drawer-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ce33a134d06fbdcab9dccc06073a7a61ee7929b5c6257f2138fb54d1ee5809d2
MD5 ebcbe11508ce61c4f83219dd10876e5a
BLAKE2b-256 29b4b985c6a5cfb37a8efde4b3831967b8cbbf3dafcbbda60680ce7c152f4782

See more details on using hashes here.

File details

Details for the file lotery_drawer-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: lotery_drawer-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for lotery_drawer-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7032155d1706f06568b9175c4eda6a577a29c82d5e0fc82b29014e3f91d06432
MD5 bf4ed2343baa52310494a0dd68817d48
BLAKE2b-256 a57fee880c7e372585ba626a4d2c9e64beb0c28e6c038cdcc979d84f62aa623f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page