randomdotorg

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

README

randomdotorg

Golang functions to roll random dice using random.org API

Usage:

package main

import (
	"fmt"

	"github.com/cemdorst/randomdotorg"
)

//RANDOMDOTORG_APIKEY env var must be set:
//export RANDOMDOTORG_APIKEY="xxxx-xxxx-xxxx-xxxx-xxxx"

func main() {

  //Roll 5 D10 dice
	d := randomdotorg.RollDice("5", "10")
	fmt.Println(d)

}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIKey string = os.Getenv("RANDOMDOTORG_APIKEY")

APIKey to access api.random.org

View Source
var ErrDiceSides = errors.New("Dice must have more than" + minsides)

ErrDiceSides states minimum Dice sides

View Source
var ErrHTTP = errors.New("HTTP related error")

ErrHTTP related to HTTP operations

View Source
var ErrJSON = errors.New("JSON Marshal/Unmarshal error")

ErrJSON related to JSON operations

Functions

func RollDice

func RollDice(n string, s string) (result []int)

RollDice will throw (n) dice with (s) sides

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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