mirror of
https://github.com/MontFerret/ferret.git
synced 2025-11-25 22:01:39 +02:00
@@ -3,6 +3,7 @@ package math
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||||
"github.com/MontFerret/ferret/pkg/runtime/values"
|
"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 {
|
if len(args) == 0 {
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
return values.NewFloat(rand.Float64()), nil
|
return values.NewFloat(rand.Float64()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user