Message Boards Message Boards

1
|
2072 Views
|
0 Replies
|
1 Total Likes
View groups...
Share
Share this post:
GROUPS:

User define random number generators, is the state private?

Posted 9 years ago

Please also take a look at the original M.SE thread where the story is still developing:

Here I'll focus my question on one detail. It is possible to use user-defined RNGs with Mathematica.. The documentation suggests that the internal state of these generators is considered private:

A generator object is of the form gsym[data] where gsym is the symbol that identifies the generator and to which rules are attached. data is effectively private to the top-level evaluations associated with the generator definitions.

Is this accurate? Does Mathematica ever mess with the internal state? Does it cache it? Does it assume that if two generator objects look identical as Mathematica expressions, they truly have the same internal state?

I wanted to implement a generator using managed library expressions, which means that the generator object is just an integer handle to a data structure stored in the library. Will this cause problems with Mathematica's RNG framework? Am I forced to store the full state on the Mathematica side?

If yes, is this clearly documented anywhere?


EDIT: To clarify, it's not unreasonable if Mathematica relies on comparisons of the internal state, but I would like to get some confirmation about whether it really is doing this.

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract