Csound Csound-dev Csound-tekno Search About

[Csnd] adding some random values to an array

Date2020-04-07 18:54
FromStefan Thomas
Subject[Csnd] adding some random values to an array
Dear community,
the answer to my question might be very simple, but I can't find the solution.
I would like to create an one dimensional array with some random values.
Does someone has an advice, how this could be done?
Thank You,
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

Date2020-04-07 19:25
Fromjoachim heintz
SubjectRe: [Csnd] adding some random values to an array
hi stefan -

this would be one possibility.  you should set
seed 0
if you want to have always new values. best -

	joachim


instr 1
  iArr[] init 10
  indx = 0
  while indx < lenarray(iArr) do
   iArr[indx] = random:i(1,10)
   indx += 1
  od
  printarray iArr
endin
schedule(1,0,0)




On 07/04/2020 19:54, Stefan Thomas wrote:
> Dear community,
> the answer to my question might be very simple, but I can't find the 
> solution.
> I would like to create an one dimensional array with some random values.
> Does someone has an advice, how this could be done?
> Thank You,
> 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

Date2020-04-08 09:51
FromStefan Thomas
SubjectRe: [Csnd] adding some random values to an array
Dear Joachim,
thanks for the answer. Worked for me!
All the best,
Stefan

Am Di., 7. Apr. 2020 um 20:25 Uhr schrieb joachim heintz <jh@joachimheintz.de>:
hi stefan -

this would be one possibility.  you should set
seed 0
if you want to have always new values. best -

        joachim


instr 1
  iArr[] init 10
  indx = 0
  while indx < lenarray(iArr) do
   iArr[indx] = random:i(1,10)
   indx += 1
  od
  printarray iArr
endin
schedule(1,0,0)




On 07/04/2020 19:54, Stefan Thomas wrote:
> Dear community,
> the answer to my question might be very simple, but I can't find the
> solution.
> I would like to create an one dimensional array with some random values.
> Does someone has an advice, how this could be done?
> Thank You,
> Stefan
>
> Csound mailing list Csound@listserv.heanet.ie
> <mailto: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