Csound Csound-dev Csound-tekno Search About

[Csnd] how to create an array with random numbers

Date2021-05-25 08:42
FromStefan Thomas
Subject[Csnd] how to create an array with random numbers
Dear community,
I've tried to fill an array with random numbers, but without success.
I can't find what's wrong with my code:
<CsoundSynthesizer>
<CsOptions>
-odac  -m0d
</CsOptions>
; ==============================================
<CsInstruments>

sr = 44100
nchnls = 2
0dbfs = 1
seed 0
opcode
StefansRandArray,i[],iii
iMin,iMax,iSize xin
iOut[] init iSize
icount = 0
while icount < iSize do
irandNum  random iMin,iMax
iOut[icount] = irandNum
icount += 1
od
xout iOut
endop

instr 1
iMin = 1
iMax = 10
iSize = 13
iArr[ ] StefansRandArray iMin,iMin,iSize
printarray iArr
endin

</CsInstruments>
; ==============================================
<CsScore>
i1 0 4
</CsScore>
</CsoundSynthesizer>

I assume there's is an obvious mistake .
I hope one of You could give me a hint!
Thanks,
Stefan

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

Date2021-05-25 13:36
FromTetsuya Miwa
SubjectRe: [Csnd] how to create an array with random numbers
Hi, Stefan,

Your UDO is ok, but the following line in instr 1

iArr[ ] StefansRandArray iMin,iMin,iSize 

should be 

iArr[ ] StefansRandArray iMin,iMax,iSize 

Best,
Tetsuya

> 2021/05/25 16:42、Stefan Thomas のメール:
> 
> Dear community,
> I've tried to fill an array with random numbers, but without success.
> I can't find what's wrong with my code:
> 
> 
> -odac  -m0d
> 
> ; ==============================================
> 
> 
> sr = 44100
> nchnls = 2
> 0dbfs = 1
> seed 0
> opcode 
> StefansRandArray,i[],iii
> iMin,iMax,iSize xin
> iOut[] init iSize
> icount = 0
> while icount < iSize do
> irandNum  random iMin,iMax
> iOut[icount] = irandNum
> icount += 1
> od
> xout iOut
> endop
> 
> instr 1 
> iMin = 1
> iMax = 10
> iSize = 13
> iArr[ ] StefansRandArray iMin,iMin,iSize 
> printarray iArr
> endin
> 
> 
> ; ==============================================
> 
> i1 0 4
> 
> 
> 
> I assume there's is an obvious mistake .
> I hope one of You could give me a hint!
> Thanks,
> Stefan
> 
> 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

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

Date2021-05-25 14:00
FromDave Seidel
SubjectRe: [Csnd] how to create an array with random numbers
Hi Tetsuya,

Those two statements look identical to me, unless I'm missing something extremely subtle...

- Dave

On Tue, May 25, 2021 at 8:36 AM Tetsuya Miwa <izc07036@nifty.com> wrote:
Hi, Stefan,

Your UDO is ok, but the following line in instr 1

iArr[ ] StefansRandArray iMin,iMin,iSize

should be

iArr[ ] StefansRandArray iMin,iMax,iSize

Best,
Tetsuya

> 2021/05/25 16:42、Stefan Thomas <kontrapunktstefan@gmail.com>のメール:
>
> Dear community,
> I've tried to fill an array with random numbers, but without success.
> I can't find what's wrong with my code:
> <CsoundSynthesizer>
> <CsOptions>
> -odac  -m0d
> </CsOptions>
> ; ==============================================
> <CsInstruments>
>
> sr = 44100
> nchnls = 2
> 0dbfs = 1
> seed 0
> opcode
> StefansRandArray,i[],iii
> iMin,iMax,iSize xin
> iOut[] init iSize
> icount = 0
> while icount < iSize do
> irandNum  random iMin,iMax
> iOut[icount] = irandNum
> icount += 1
> od
> xout iOut
> endop
>
> instr 1
> iMin = 1
> iMax = 10
> iSize = 13
> iArr[ ] StefansRandArray iMin,iMin,iSize
> printarray iArr
> endin
>
> </CsInstruments>
> ; ==============================================
> <CsScore>
> i1 0 4
> </CsScore>
> </CsoundSynthesizer>
>
> I assume there's is an obvious mistake .
> I hope one of You could give me a hint!
> Thanks,
> Stefan
>
> 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

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
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

Date2021-05-25 15:04
FromTetsuya Miwa
SubjectRe: [Csnd] how to create an array with random numbers
Hi Dave,

It’s a simple typo. In the original code, the second parameter for StefansRandArray is iMin, but it should be iMax.

Best,
Tetsuya

> 2021/05/25 22:00、Dave Seidel のメール:
> 
> Hi Tetsuya,
> 
> Those two statements look identical to me, unless I'm missing something extremely subtle...
> 
> - Dave
> 
> On Tue, May 25, 2021 at 8:36 AM Tetsuya Miwa  wrote:
> Hi, Stefan,
> 
> Your UDO is ok, but the following line in instr 1
> 
> iArr[ ] StefansRandArray iMin,iMin,iSize 
> 
> should be 
> 
> iArr[ ] StefansRandArray iMin,iMax,iSize 
> 
> Best,
> Tetsuya
> 
> > 2021/05/25 16:42、Stefan Thomas のメール:
> > 
> > Dear community,
> > I've tried to fill an array with random numbers, but without success.
> > I can't find what's wrong with my code:
> > 
> > 
> > -odac  -m0d
> > 
> > ; ==============================================
> > 
> > 
> > sr = 44100
> > nchnls = 2
> > 0dbfs = 1
> > seed 0
> > opcode 
> > StefansRandArray,i[],iii
> > iMin,iMax,iSize xin
> > iOut[] init iSize
> > icount = 0
> > while icount < iSize do
> > irandNum  random iMin,iMax
> > iOut[icount] = irandNum
> > icount += 1
> > od
> > xout iOut
> > endop
> > 
> > instr 1 
> > iMin = 1
> > iMax = 10
> > iSize = 13
> > iArr[ ] StefansRandArray iMin,iMin,iSize 
> > printarray iArr
> > endin
> > 
> > 
> > ; ==============================================
> > 
> > i1 0 4
> > 
> > 
> > 
> > I assume there's is an obvious mistake .
> > I hope one of You could give me a hint!
> > Thanks,
> > Stefan
> > 
> > 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
> 
> 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
> 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

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

Date2021-05-25 18:24
FromStefan Thomas
SubjectRe: [Csnd] how to create an array with random numbers
Oh, how stupid!
Don't know why I didn't see it!
Thanks!

Am Di., 25. Mai 2021 um 14:36 Uhr schrieb Tetsuya Miwa <izc07036@nifty.com>:
Hi, Stefan,

Your UDO is ok, but the following line in instr 1

iArr[ ] StefansRandArray iMin,iMin,iSize

should be

iArr[ ] StefansRandArray iMin,iMax,iSize

Best,
Tetsuya

> 2021/05/25 16:42、Stefan Thomas <kontrapunktstefan@gmail.com>のメール:
>
> Dear community,
> I've tried to fill an array with random numbers, but without success.
> I can't find what's wrong with my code:
> <CsoundSynthesizer>
> <CsOptions>
> -odac  -m0d
> </CsOptions>
> ; ==============================================
> <CsInstruments>
>
> sr = 44100
> nchnls = 2
> 0dbfs = 1
> seed 0
> opcode
> StefansRandArray,i[],iii
> iMin,iMax,iSize xin
> iOut[] init iSize
> icount = 0
> while icount < iSize do
> irandNum  random iMin,iMax
> iOut[icount] = irandNum
> icount += 1
> od
> xout iOut
> endop
>
> instr 1
> iMin = 1
> iMax = 10
> iSize = 13
> iArr[ ] StefansRandArray iMin,iMin,iSize
> printarray iArr
> endin
>
> </CsInstruments>
> ; ==============================================
> <CsScore>
> i1 0 4
> </CsScore>
> </CsoundSynthesizer>
>
> I assume there's is an obvious mistake .
> I hope one of You could give me a hint!
> Thanks,
> Stefan
>
> 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

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
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

Date2021-05-25 18:55
FromPete Goodeve
SubjectRe: [Csnd] how to create an array with random numbers
AttachmentsNone