[Csnd] how to create an array with random numbers
| Date | 2021-05-25 08:42 | 
| From | Stefan 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 | 
| Date | 2021-05-25 13:36 | 
| From | Tetsuya Miwa | 
| Subject | Re: [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 | 
| Date | 2021-05-25 14:00 | 
| From | Dave Seidel | 
| Subject | Re: [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, | 
| Date | 2021-05-25 15:04 | 
| From | Tetsuya Miwa | 
| Subject | Re: [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 | 
| Date | 2021-05-25 18:24 | 
| From | Stefan Thomas | 
| Subject | Re: [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, | 
| Date | 2021-05-25 18:55 | 
| From | Pete Goodeve | 
| Subject | Re: [Csnd] how to create an array with random numbers | 
| Attachments | None |