Documentation ¶
Index ¶
- func EstimateRemainingTime(timeStart time.Time, current int64, total int64) (percentage float64, remaining time.Duration)
- func GetUint32Diff(newCount uint32, oldCount uint32) uint32
- func RandomInsecure(min int, max int) int
- func RandomKerlHashTrytesInsecure() trinary.Hash
- func RandomTrytesInsecure(length int) trinary.Trytes
- type TimeHeap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateRemainingTime ¶ added in v0.5.0
func EstimateRemainingTime(timeStart time.Time, current int64, total int64) (percentage float64, remaining time.Duration)
EstimateRemainingTime estimates the remaining time for a running operation and returns the finished percentage.
func GetUint32Diff ¶
GetUint32Diff returns the difference between newCount and oldCount and catches overflows
func RandomInsecure ¶
RandomInsecure returns a random int in the range of min to max. the result is not cryptographically secure. RandomInsecure is inclusive max value.
func RandomKerlHashTrytesInsecure ¶ added in v0.5.4
RandomKerlHashTrytesInsecure returns random hash trytes. Since the result mimics a Kerl hash, the last trit will be zero.
func RandomTrytesInsecure ¶
RandomTrytesInsecure returns random Trytes with the given length. the result is not cryptographically secure. DO NOT USE this function to generate a seed.
Types ¶
type TimeHeap ¶
type TimeHeap struct {
// contains filtered or unexported fields
}
TimeHeap implements a heap sorted by time, where older elements are popped during GetAveragePerSecond call.
func (*TimeHeap) GetAveragePerSecond ¶
GetAveragePerSecond calculates the average per second of all entries in the given duration. older elements are removed from the container.