Getting value of psuedo-randomly generated seed

adudek's icon

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.

TFL's icon

[getattr seed] should help you.

adudek's icon

Perfect! Thank you. Where has [getattr] been all my life?

adudek's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

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.

Roman Thilenius's icon

solution: build custom urn from random.

adudek's icon

Yes, thanks everyone. The workaround is to build an urn-like abstraction that uses <random>.