mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
committed by
Bjørn Erik Pedersen
parent
9cd8fbb332
commit
e40b9fbbcf
@@ -18,6 +18,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
|
||||
@@ -157,6 +158,11 @@ func (ns *Namespace) Pow(n1, n2 any) (float64, error) {
|
||||
return math.Pow(af, bf), nil
|
||||
}
|
||||
|
||||
// Rand returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0).
|
||||
func (ns *Namespace) Rand() float64 {
|
||||
return rand.Float64()
|
||||
}
|
||||
|
||||
// Round returns the integer nearest to n, rounding half away from zero.
|
||||
func (ns *Namespace) Round(n any) (float64, error) {
|
||||
xf, err := cast.ToFloat64E(n)
|
||||
|
Reference in New Issue
Block a user