https://github.com/cdfn/rangomorg
Rangom is random.org wrapper for Go. Currently it contains only signed api.
https://github.com/cdfn/rangomorg
go golang-module randomorg
Last synced: about 1 year ago
JSON representation
Rangom is random.org wrapper for Go. Currently it contains only signed api.
- Host: GitHub
- URL: https://github.com/cdfn/rangomorg
- Owner: CDFN
- Created: 2020-04-16T10:59:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-18T08:44:39.000Z (about 6 years ago)
- Last Synced: 2025-02-17T12:29:37.530Z (over 1 year ago)
- Topics: go, golang-module, randomorg
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RangomOrg
RangomOrg is wrapper for random.org API. It's very simple to use!
Dependencies:
Name | URL
--------|-------
jsonrpc | github.com/ybbus/jsonrpc
Usage:
```Go
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
}
```