Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"seed" does not work on [drunk] / "seed 0" not working for [urn] #649

Open
betodaviola opened this issue Oct 2, 2024 · 10 comments
Open

Comments

@betodaviola
Copy link

It appears that "seed 0" does not work as expected with [drunk]. While this might not be a major issue on its own, the lack of documentation on this behavior can be confusing—especially since "seed 0" works correctly with [random]. Users may assume the behavior is consistent between [drunk] and [random], leading to unexpected results.

Would it be possible to clarify this behavior in the documentation, or ensure "seed 0" works similarly across both objects?

@porres
Copy link
Owner

porres commented Oct 2, 2024

what is the problem with 'seed 0' in drunk? how does it not behave as it was supposed to? How was it supposed to behave and how does it behave?

@porres
Copy link
Owner

porres commented Oct 2, 2024

seems 'seed' doesn't work at al... :)

why do you use this anyway? you know ELSE has a nice and better 'drunkard' object that actually just works? :)

@porres porres changed the title "seed 0" does not work on [drunk] "seed" does not work on [drunk] Oct 2, 2024
@betodaviola
Copy link
Author

betodaviola commented Oct 2, 2024

EDIT: mixed up the reply for two different messages.

what is the problem with 'seed 0' in drunk? how does it not behave as it was supposed to? How was it supposed to behave and how does it behave?

If I have, for example, two [random 1000] on different parts of my patch and before the numbers are generated I send them a message with "seed 0", they will generate the same numbers, at the same order, which is the whole point of seeding the random number generator. As one would expect, if I send any number instead of 0 the same thing will happen, desired behavior.
With [drunk], on the other hand, I don't get this behavior if the seed equals 0, only if it is other numbers. Two different [drunk] objects that receive a "seed 0" message before their numbers start being generated will not generate the same numbers, in the same order, as it happened on random. I would expect that "seed 0" would work for drunk on the same way it works for random since I could not find any mention of this distinction on the documentation.
In my case, I had to have my seeds randomly generated by many particular reasons. I knew that I didn't have to be concerned with getting "seed 0" on [random] but I was unaware about this [drunk] particularity. Having that on the documentation would have saved me a long time of debugging and trying to figure out what was broken. I needed the [drunk] results to be consistent every time I run the patch with an specific input.
Unfortunately, I found the same problem on [urn].

@betodaviola
Copy link
Author

seems 'seed' doesn't work at al... :)

why do you use this anyway? you know ELSE has a nice and better 'drunkard' object that actually just works? :)

I apologize, but I am confused now. I even tested again, and seed not only DOES clearly works on [drunk] (when it is seeded by any integer bigger than 0), it is also on the drunk-help.pd

I don't know how to test this better, but I created multiple [drunk 1000] objects, seeded them on pairs with different numbers and generated a bunch of numbers on them at the same time. All absolutely consistent, generating the same numbers on the same order if they have the same seed, except when it is "seed 0".

I didn't know about the drunkard object, as I have been using drunk for years now. Thank you the suggestion, I will check that one out later today.

As for why I use it, which I am not sure should be the topic of the thread, I need all the numbers generated by [random], [urn], and [drunk] to be the same, based on a single input (converted to a number). My solution was to use the input number to seed a [random] object, which generates 20 numbers when the patch boots. These 20 numbers are used for everything in the project, including seeding the urns and drunks. Eventualy, some of these numbers would be 0, which would not be a big deal if, on the documentation, it was explained that "seed 0" does not work for [urn] and [drunk], even though it works for [random].
Since I am very close to finishing up the project, altering the 20 generated initial numbers range to not include 0 would break a lot of things, so I had to create two abstractions called [myDrunk] and [myUrn], test it as much as I could, and substitute my 100+ urns and drunks in the code, before running a lot of tests again.

@porres
Copy link
Owner

porres commented Oct 2, 2024

I apologize, but I am confused now. I even tested again, and seed not only DOES clearly works on [drunk] (when it is seeded by any integer bigger than 0), it is also on the drunk-help.pd

I mentioned that and changed the title of the bug report, so, yeah, the 'seed' message is simply not working, right?

@porres porres changed the title "seed" does not work on [drunk] "seed" does not work on [drunk] / "seed 0" not working for [urn] Oct 2, 2024
@porres
Copy link
Owner

porres commented Oct 2, 2024

I found the same problem on [urn].

I see that unlike [drunk], [urn] works ok with the seed message, but not with "seed 0".

btw, [else/rand.u] is much better than [urn] I think :)

@betodaviola
Copy link
Author

I found the same problem on [urn].

I see that unlike [drunk], [urn] works ok with the seed message, but not with "seed 0".

btw, [else/rand.u] is much better than [urn] I think :)

Thank you for the suggestion, I will definitely check it out and starting using it on my future projects.

@betodaviola
Copy link
Author

betodaviola commented Oct 3, 2024

I mentioned that and changed the title of the bug report, so, yeah, the 'seed' message is simply not working, right?

If it is "seed 0", no it does not

@porres
Copy link
Owner

porres commented Oct 4, 2024

If it is "seed 0", no it does not

I know that, it's not what I asked. As I see, 'seed' is not working at all, regardless of the seed value

Anyway, I will check both cases and fix for the next release

@betodaviola
Copy link
Author

If it is "seed 0", no it does not

I know that, it's not what I asked. As I see, 'seed' is not working at all, regardless of the seed value

Anyway, I will check both cases and fix for the next release

I am sorry, it is my first time opening an issue and I am not used with this. It works with any other value, only not with 0.

In any case, I just realized that I am getting "rand_seed failed (newticks 689663796)" on the terminal, which I am not sure how I missed before. I am sure it has something to do with it since I do not get this print at all on my terminal when I use any seed that is not 0. Again, this behavior is also consistent between urn and drunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants