random

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 6 Imported by: 68

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(n int) []byte

Bytes generates a random byte slice of length n

func Codr

func Codr() string

Codr generates Codr for instance: 4/6

func Datr

func Datr() string

Datr generates Datr for instance: SF4BW125

func Freq

func Freq() float32

Freq generates a frequency between 865.0 and 870.0 Mhz

func Intn

func Intn(n int) int

Intn returns random int with max n

func Lsnr

func Lsnr() float32

Lsnr generates LoRa SNR ratio in db. Tend towards generating good ratio with low noise

func Rssi

func Rssi() int32

Rssi generates RSSI signal between -120 < rssi < 0

func String

func String(n int) string

String returns random string of length n

func Token

func Token() []byte

Token generate a random 2-bytes token

Types

type TTNRandom

type TTNRandom struct {
	// contains filtered or unexported fields
}

TTNRandom is used as a wrapper around math/rand

func New

func New() *TTNRandom

New returns a new TTNRandom, in most cases you can just use the global funcs

func (*TTNRandom) Bytes

func (r *TTNRandom) Bytes(n int) []byte

Bytes generates a random byte slice of length n

func (*TTNRandom) Codr

func (r *TTNRandom) Codr() string

Codr generates Codr for instance: 4/6

func (*TTNRandom) Datr

func (r *TTNRandom) Datr() string

Datr generates Datr for instance: SF4BW125

func (*TTNRandom) Freq

func (r *TTNRandom) Freq() float32

Freq generates a frequency between 865.0 and 870.0 Mhz

func (*TTNRandom) Intn

func (r *TTNRandom) Intn(n int) int

Intn wraps rand.Intn

func (*TTNRandom) Lsnr

func (r *TTNRandom) Lsnr() float32

Lsnr generates LoRa SNR ratio in db. Tend towards generating good ratio with low noise

func (*TTNRandom) Rssi

func (r *TTNRandom) Rssi() int32

Rssi generates RSSI signal between -120 < rssi < 0

func (*TTNRandom) String

func (r *TTNRandom) String(n int) string

String returns random string of length n

func (*TTNRandom) Token

func (r *TTNRandom) Token() []byte

Token generate a random 2-bytes token

Jump to

Keyboard shortcuts

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