Skip to content
/ rangomorg Public

Rangom is random.org wrapper for Go. Currently it contains only signed api.

Notifications You must be signed in to change notification settings

CDFN/rangomorg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RangomOrg

RangomOrg is wrapper for random.org API. It's very simple to use!
Dependencies:

Name URL
jsonrpc github.com/ybbus/jsonrpc

Usage:

package main

import (
	"encoding/json"
	"fmt"
	"github.com/CDFN/rangomorg"
	"log"
)

const (
	randomApiKey = "your-api-key"
)

func main() {
	random := rangomorg.New(randomApiKey)
	result, err := random.GenerateSignedStrings(5, 10, "rangom", map[string]interface{}{
		"userData": "YourUserData", // These options are optional
		"replacement": true,        // see https://api.random.org/json-rpc/2 for more
	})
	if err != nil {
		log.Fatal(err.Error())
	}
	jsonBytes, _ := json.MarshalIndent(result, "", "    ")
	fmt.Println("Random: ")
	fmt.Println(string(jsonBytes))                      // Display result in json form
	fmt.Println("Requested data: ", result.Random.Data) // Display requested data
	fmt.Println("Signature: ", result.Signature)        // In case of signed api, display signature
}

About

Rangom is random.org wrapper for Go. Currently it contains only signed api.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages