mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-04 10:35:08 +02:00
parent
c9dfb79641
commit
7d7253325e
@ -3,6 +3,7 @@ package math
|
||||
import (
|
||||
"context"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/values"
|
||||
@ -20,6 +21,7 @@ func Rand(_ context.Context, args ...core.Value) (core.Value, error) {
|
||||
}
|
||||
|
||||
if len(args) == 0 {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
return values.NewFloat(rand.Float64()), nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user