Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Using "Seed" for Reproducibility is Yielding Unexpected Results

Date2021-01-07 17:48
Fromjdm771
SubjectRe: [Csnd] Using "Seed" for Reproducibility is Yielding Unexpected Results
Hi Matthew and John,

Thank you. I appreciate the responses.

I saw from the manual that "seed" values need to be integers between 0 and 2^32. I figured since the Example numbers are less than 2^32 (i.e., 4294967296) that all would be well.

I got the Example numbers from the output console when the "seed" value was derived from the system clock (e.g., when "seed" is given a value of "0" and it outputs something such as: "WARNING: Seeding from current time 4068222153").

Sometimes I will run code, letting "seed" get its value from the system clock (by assigning "seed" to "0"). Then, when I find a run that I like, I will take that last clock value (i.e., from "WARNING Seeding from current time ...") and program it into "seed". (This works, but, it turns out, is problematic when the numbers get too big.) 

From what you have said, I then thought that when "seed" is given a value of "0" and it reads its value from the system clock, it is accepting an unsigned integer (i.e., a range of 0 to (2^32)-1 = 0 to 4294967295). Whereas, when supplying a value to "seed" directly (via code), it needs to be a signed integer (i.e., from (-2^31) to (2^31)-1 = –2147483648 to 2147483647).

Indeed, I discovered that when I put in any values for "seed" above 2147483647, it appears to return the same result.

So, I tried converting the unsigned integer from the system clock and to a signed integer. For example, 3665754676 converts to -629212620. But both numbers yielded the same result (i.e., the same result when "seed" is assigned a value, via code, that is higher than 2147483647).

I then tried truncating the unsigned integer from the system clock from the front, and then from the end, but neither worked.

Also, it appears that assigning "seed" to -2 to -2147483648 appears to give the same result. Strangely, -1 and -2147483649 and lower appear to give varying results.

Any thoughts on this? That is, on how to replicate a run that is seeded from the system clock when the value from system clock is higher than 2147483647?

Thank you,

John

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here