Csound Csound-dev Csound-tekno Search About

[Csnd-dev] what is the default seed?

Date2023-02-01 14:03
Fromjoachim heintz
Subject[Csnd-dev] what is the default seed?
when we don't set the seed, it uses a default value so that 
random:i(10,20) always yields the same result.

in the manual page for seed there is no information about this default 
value.

can it be expressed as input for seed, like seed(1)?

thanks -
	joachim

Date2023-03-25 18:38
FromSteven Yi
SubjectRe: [Csnd-dev] what is the default seed?
Hi Joachim,

Thought I'd reply to this, I dug in and found that random:i uses
holdrand variable which defaults to the value 2345678. If you do a
test:

print random:i(0,100)
print random:i(0,100)
print random:i(0,100)
seed(2345678)
print random:i(0,100)
print random:i(0,100)
print random:i(0,100)

You should get:

instr 0:  #i0 = 88.287
instr 0:  #i1 = 29.134
instr 0:  #i2 = 92.571
instr 0:  #i3 = 88.287
instr 0:  #i4 = 29.134
instr 0:  #i5 = 92.571

On Wed, Feb 1, 2023 at 9:03 AM joachim heintz  wrote:
>
> when we don't set the seed, it uses a default value so that
> random:i(10,20) always yields the same result.
>
> in the manual page for seed there is no information about this default
> value.
>
> can it be expressed as input for seed, like seed(1)?
>
> thanks -
>         joachim

Date2023-03-25 20:53
Fromjoachim heintz
SubjectRe: [Csnd-dev] what is the default seed?
wow cool --- thanks steven!!!
best -
	joachim


On 25/03/2023 19:38, Steven Yi wrote:
> Hi Joachim,
> 
> Thought I'd reply to this, I dug in and found that random:i uses
> holdrand variable which defaults to the value 2345678. If you do a
> test:
> 
> print random:i(0,100)
> print random:i(0,100)
> print random:i(0,100)
> seed(2345678)
> print random:i(0,100)
> print random:i(0,100)
> print random:i(0,100)
> 
> You should get:
> 
> instr 0:  #i0 = 88.287
> instr 0:  #i1 = 29.134
> instr 0:  #i2 = 92.571
> instr 0:  #i3 = 88.287
> instr 0:  #i4 = 29.134
> instr 0:  #i5 = 92.571
> 
> On Wed, Feb 1, 2023 at 9:03 AM joachim heintz  wrote:
>>
>> when we don't set the seed, it uses a default value so that
>> random:i(10,20) always yields the same result.
>>
>> in the manual page for seed there is no information about this default
>> value.
>>
>> can it be expressed as input for seed, like seed(1)?
>>
>> thanks -
>>          joachim