Skip to content

Instantly share code, notes, and snippets.

@jbratu
Created July 7, 2016 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbratu/cc74c5dc24443d65278bfc990a97be19 to your computer and use it in GitHub Desktop.
Save jbratu/cc74c5dc24443d65278bfc990a97be19 to your computer and use it in GitHub Desktop.
The OpenInsight random number generator is pseudo-random and running simultaneous sessions on the same computer can result in the same random number results. This snippet calls the JScript random number generator.
common /csRnd/ WScript, init%
If Assigned(init%) Else init% = ''
If init% else
WScript = oleCreateInstance("ScriptControl")
OlePutProperty(wscript, "Language", "JScript")
s = 'function getrandom() {return Math.random();}'
x = WScript->AddCode(s)
init% = 1
end
RetVal = WScript->Eval("getrandom();") * 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment