1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

add support for an external Math.random() provider

This commit is contained in:
deoxxa
2016-02-18 22:08:25 +11:00
parent c21072f61b
commit fd1eddd0f9
4 changed files with 41 additions and 1 deletions

View File

@@ -363,6 +363,10 @@ func (self Otto) SetDebuggerHandler(fn func(vm *Otto)) {
self.runtime.debugger = fn
}
func (self Otto) SetRandomSource(fn func() float64) {
self.runtime.random = fn
}
// Context is a structure that contains information about the current execution
// context.
type Context struct {