You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first call to PN.RND always returns the same value, after seeding the randomization via P.SEED with any seed. Subsequent calls of PN.RND are random.
I'm happy to look into this, but please let me if you have any pointers or I'm misunderstanding the feature.
Please include the hash displayed at startup and the release of the software (e.g. "Teletype v2.0.1 5f838c9")
Teletype v5.0.0 00FDFD2
What steps are required to reproduce the bug?
fill pattern 0 with values P.SEED x PN.RND 0
will always return the same value, regardless of x
Alternatively, filling 0 with values, and pattern 1 with seeds, then create a script like:
P.SEED PN.NEXT1
PN.NEXT 2 PN.RND 0
then trigger the script repeatedly to fill pattern 2 with the same value
The text was updated successfully, but these errors were encountered:
I can reproduce this. The behavior is consistent with a call to random_next() with an uninitialized random state (r and z both 0), but from a quick skim of the code it looks like the pattern random state should be initialized alongside all the other random data in the scene state, none of which exhibit this issue. Could be possible that something is accidentally stomping on just the pattern random state after initialization.
I think because we're using a constant to initialize zhere we're not fully randomly seeding.
I don't have a C toolchain here at work, but I was able to reproduce with the algorithm in Python. The numbers produced are different, but are similar, especially at the end. After a few iterations it shakes out. We're taking the mod of the random value to choose from the pattern, which I guess is why it hasn't been so obvious in other contexts? (Although I've noticed the initial value from ops like RAND 10000 with different seeds tend to be clustered.)
Switching to r->z = ~seed seems to resolve it.
Will test properly with Teletype when I'm home and throw up a PR in the next day or two.
Please describe the bug.
The first call to
PN.RND
always returns the same value, after seeding the randomization viaP.SEED
with any seed. Subsequent calls ofPN.RND
are random.I'm happy to look into this, but please let me if you have any pointers or I'm misunderstanding the feature.
Please include the hash displayed at startup and the release of the software (e.g. "Teletype v2.0.1 5f838c9")
Teletype v5.0.0 00FDFD2
What steps are required to reproduce the bug?
fill pattern 0 with values
P.SEED x
PN.RND 0
will always return the same value, regardless of
x
Alternatively, filling 0 with values, and pattern 1 with seeds, then create a script like:
then trigger the script repeatedly to fill pattern 2 with the same value
The text was updated successfully, but these errors were encountered: