Getting value of psuedo-randomly generated seed
For the <random> and <urn> objects, if the default seed value (0) is used, the seed is generated psuedo-randomly in the object. Is it possible to learn what seed value was generated internally (using the time elapsed since system startup) for any bang of the object? I know that I can set my own seeds. I just wonder if I can keep a history of the pseudo-randomly generated ones.
I have some workarounds. I just wonder if this is possible.
[getattr seed] should help you.
Perfect! Thank you. Where has [getattr] been all my life?
I may have spoken too soon. [getattr seed] works fine for [random] but doesn't work for [urn]. No attributes appear to be available for urn. I've hooked up both the getattr object and the attrui object to [urn] and get nothing back from either. As I said, the identical logic works as expected for [random]. Here's an example patch.
Oh you're right! [getattr] does what it says, it gets attributes, and sadly Urn doesn't have a "seed" attribute, but only a method/function to set the seed.
This said, you could remake an Urn based on random so you could get its automatically attributed seed.
solution: build custom urn from random.
Yes, thanks everyone. The workaround is to build an urn-like abstraction that uses <random>.