Csound Csound-dev Csound-tekno Search About

[Cs-dev] rnd text incorrect

Date2010-07-19 20:51
Frommenno
Subject[Cs-dev] rnd text incorrect
hi,

some text in the manual regarding rnd is incorrect.
rnd.csd produces the following output:

instr 1:  i1 = 0.974
instr 1:  i1 = 0.139


and NOT like it is now:

rnd at i-rate: 0.973500 rnd at k-rate: 0.139405
rnd at i-rate: 0.973500 rnd at k-rate: 0.040065
rnd at i-rate: 0.973500 rnd at k-rate: 0.412845
rnd at i-rate: 0.973500 rnd at k-rate: 0.440650
rnd at i-rate: 0.973500 rnd at k-rate: 0.663581
rnd at i-rate: 0.973500 rnd at k-rate: 0.876723
rnd at i-rate: 0.973500 rnd at k-rate: 0.302459
rnd at i-rate: 0.973500 rnd at k-rate: 0.398580
rnd at i-rate: 0.973500 rnd at k-rate: 0.448875
rnd at i-rate: 0.973500 rnd at k-rate: 0.907728

can somebody please rectify (if approved) ?

Menno

-- 
View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p1465863.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-07-20 17:27
FromAndres Cabrera
SubjectRe: [Cs-dev] rnd text incorrect
Hi,

I've just made a new example for rnd:



; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o rnd.wav -W ;;; for file output any platform



; Andres Cabrera 2010

sr = 44100
ksmps = 4410
nchnls = 1
0dbfs = 1

instr 1
	; Generate a random number from 0 to 10.
	irand = rnd(10)
	print irand
endin

instr 2
	krand = rnd(10)
	printk 0, krand
endin




i 1 0 1  ; Generate 1 number
i 1 0 1  ; Generate another number
i 1 0 1  ; yet another number

i 2 2 1  ; 1 second prints 9 values (kr = 10)
e




But I was a bit surprised by the output, as it seems the k-rate output
doesn't change...

SECTION 1:
new alloc for instr 1:
instr 1:  irand = 9.735
new alloc for instr 1:
instr 1:  irand = 1.394
new alloc for instr 1:
instr 1:  irand = 7.695
midi channel 1 now using instr 1
B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.00000
new alloc for instr 2:
 i   2 time     2.10000:     5.25005
 i   2 time     2.20000:     5.25005
 i   2 time     2.30000:     5.25005
 i   2 time     2.40000:     5.25005
 i   2 time     2.50000:     5.25005
 i   2 time     2.60000:     5.25005
 i   2 time     2.70000:     5.25005
 i   2 time     2.80000:     5.25005
 i   2 time     2.90000:     5.25005
B  2.000 ..  3.000 T  3.000 TT  3.000 M:  0.00000
Score finished in csoundPerformKsmps().

Is this a bug in rnd?

Cheers,
Andrés

On Mon, Jul 19, 2010 at 8:51 PM, menno  wrote:
>
> hi,
>
> some text in the manual regarding rnd is incorrect.
> rnd.csd produces the following output:
>
> instr 1:  i1 = 0.974
> instr 1:  i1 = 0.139
>
>
> and NOT like it is now:
>
> rnd at i-rate: 0.973500 rnd at k-rate: 0.139405
> rnd at i-rate: 0.973500 rnd at k-rate: 0.040065
> rnd at i-rate: 0.973500 rnd at k-rate: 0.412845
> rnd at i-rate: 0.973500 rnd at k-rate: 0.440650
> rnd at i-rate: 0.973500 rnd at k-rate: 0.663581
> rnd at i-rate: 0.973500 rnd at k-rate: 0.876723
> rnd at i-rate: 0.973500 rnd at k-rate: 0.302459
> rnd at i-rate: 0.973500 rnd at k-rate: 0.398580
> rnd at i-rate: 0.973500 rnd at k-rate: 0.448875
> rnd at i-rate: 0.973500 rnd at k-rate: 0.907728
>
> can somebody please rectify (if approved) ?
>
> Menno
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p1465863.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 


Andrés

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/l

Date2010-07-25 18:01
Frommenno
SubjectRe: [Cs-dev] rnd text incorrect
i do not know if it is a bug, but i get the same results. Should instr 2 not
produce a random number between 0 and 10?

menno

-- 
View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p2134999.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-07-25 18:09
FromVictor Lazzarini
SubjectRe: [Cs-dev] rnd text incorrect
No, only if you seed it differently every time. With the same seed all  
random number generators produce the same sequence.

Victor
On 25 Jul 2010, at 18:01, menno wrote:

>
> i do not know if it is a bug, but i get the same results. Should  
> instr 2 not
> produce a random number between 0 and 10?
>
> menno
>
> -- 
> View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p2134999.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-07-25 18:14
FromAndres Cabrera
SubjectRe: [Cs-dev] rnd text incorrect
Just realized the problem, doing
rnd(10) is interpreted as i-rate.

You must do:
klimit = 10
rnd(klimit)

to force rnd to be k-rate.

Cheers,
Andrés

On Sun, Jul 25, 2010 at 6:09 PM, Victor Lazzarini
 wrote:
> No, only if you seed it differently every time. With the same seed all
> random number generators produce the same sequence.
>
> Victor
> On 25 Jul 2010, at 18:01, menno wrote:
>
>>
>> i do not know if it is a bug, but i get the same results. Should
>> instr 2 not
>> produce a random number between 0 and 10?
>>
>> menno
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p2134999.html
>> Sent from the Csound - Dev mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 


Andrés

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/li

Date2010-07-25 18:23
FromVictor Lazzarini
SubjectRe: [Cs-dev] rnd text incorrect
Sorry, what I should have said is (quoting the manual):

"Returns a random number in a unipolar range at the rate given by the  
input argument."

hence

krand = rnd(10)

and

krn = 10
krand = rnd(krn)

will produce different results. The latter will produce new numbers at  
k-rate.

Victor

On 25 Jul 2010, at 18:09, Victor Lazzarini wrote:

> No, only if you seed it differently every time. With the same seed all
> random number generators produce the same sequence.
>
> Victor
> On 25 Jul 2010, at 18:01, menno wrote:
>
>>
>> i do not know if it is a bug, but i get the same results. Should
>> instr 2 not
>> produce a random number between 0 and 10?
>>
>> menno
>>
>> -- 
>> View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p2134999.html
>> Sent from the Csound - Dev mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-07-25 18:25
FromAndres Cabrera
SubjectRe: [Cs-dev] rnd text incorrect
I should remember to RTFM more often... =)

Cheers,
Andrés

On Sun, Jul 25, 2010 at 6:23 PM, Victor Lazzarini
 wrote:
> Sorry, what I should have said is (quoting the manual):
>
> "Returns a random number in a unipolar range at the rate given by the
> input argument."
>
> hence
>
> krand = rnd(10)
>
> and
>
> krn = 10
> krand = rnd(krn)
>
> will produce different results. The latter will produce new numbers at
> k-rate.
>
> Victor
>
> On 25 Jul 2010, at 18:09, Victor Lazzarini wrote:
>
>> No, only if you seed it differently every time. With the same seed all
>> random number generators produce the same sequence.
>>
>> Victor
>> On 25 Jul 2010, at 18:01, menno wrote:
>>
>>>
>>> i do not know if it is a bug, but i get the same results. Should
>>> instr 2 not
>>> produce a random number between 0 and 10?
>>>
>>> menno
>>>
>>> --
>>> View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p2134999.html
>>> Sent from the Csound - Dev mailing list archive at Nabble.com.
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.net email is sponsored by Sprint
>>> What will you do first with EVO, the first 4G phone?
>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 


Andrés

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/li

Date2010-07-25 19:05
Frommenno
SubjectRe: [Cs-dev] rnd text incorrect
this is exactly why the manual needs good examples for every opcode! 
-- 
View this message in context: http://csound.1045644.n5.nabble.com/rnd-text-incorrect-tp1465863p2140211.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-07-25 19:34
Fromandy fillebrown
SubjectRe: [Cs-dev] rnd text incorrect
laughing at the irony...

~ af


> I should remember to RTFM more often... =)
>
> Cheers,
> Andrés

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net