diceroller

command module
v0.0.0-...-364c433 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 12 Imported by: 0

README

diceroller

A tool for generating fair or biades dice-rolls for an arbitrary sided dice. It supports command line and can be started as a rest service.

Command line

Throw a fair 6-sided dice one time

.\diceroll.exe 

Throw a fair 6-sided dice 10 times

.\diceroll.exe -rolls 10

Throw a biased 3-sided dice 6 times

.\diceroll.exe -rolls 6 -odds "1,1,2"
.\diceroll.exe -rolls 6 -probs "1/4,1/4,2/4"

API

Compile and run with -srv flag. For example in windows

diceroller -srv

Optionally a port can be supplied

diceroller -srv -port 8080

Default port is 10000

Request format

http://localhost:10000/:rolls
http://localhost:10000/:rolls/odds/:data
http://localhost:10000/:rolls/probs/:data

:rolls is the integer that definies the amount of dice rolls requested

Example of requests:

http://localhost:10000/1
http://localhost:10000/100

Optionally the number of dice-sides and their odds or probablitites can be set up for the dice rolls. :data is a comma separated list of the sides and their respective odds or propabilites.

Example a three-sided dice where side 1 & 2 have a probability of 0.25 and side 3 have a probability of 0.5.

http://localhost:10000/10/odds/1,1,2
http://localhost:10000/10/probs/0.25,0.25,0.5

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL