What you see is just printf rounding due to %f being limited to 6 comma places. Try:
instr Test
indx = 1
while indx < 1000000000 do
iRnd = rnd:i1
if iRnd > .9999998 then
printf_i "rnd1 = %.12f in cycle %d.\n", indx, iRnd, indx
endif
indx += 1
od
endin
> I guess that clears up the question, then :\-)
> Thanks for checking!
>
> -- Pete--
>
> > well just by trial ...
> >
> > instr Test
> > indx = 1
> > while indx < 10000000 do
> > iRnd = rnd:i1
> > if iRnd > .999999 then
> > printf_i "rnd1 = %f in cycle %d.\n", indx, iRnd, indx
> > endif
> > indx += 1
> > od
> > endin
> > schedule"Test",0,0
> >
> > ... i get this:
> >
> > rnd1 = 0.999999 in cycle 4820758.
> > rnd1 = 1.000000 in cycle 6319223.
> > rnd1 = 0.999999 in cycle 7789384.
> > rnd1 = 1.000000 in cycle 9287849.
> >
> > in other words: it takes some time, but it is not impossible.
> >
> > j
> >
> >>> Hi all,
> >>>
> >>> I thought all the random number generators having range parameter in
> >>> Csound return the number in closed range a <= N <= b, \[a,b\].
> >>> However, I started to feel less confident about it after checking the
> >>> manual.
> >>> For example, the manual says rndx returns a random number in the
> >>> unipolar range 0 to x.
> >>> Is it [0,x] or [0,x) semi\-open?
> >>>
> >> Not sure of your notation there, and one of the developers will have
> >> to give the definitive answer, but as far as I know 'rnd10' can include
> >> the exact output '10', not just "arbitrarily close, but never exactly...".
> >>
> >> However, ift is really random, it might be hard to tell!
> >>
> >> -- Pete --
> >>
> >> Csound mailing list
> >> Csound@listserv.heanet.ie
> >> LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE
> >> Send bugs reports to
> >> Issues · csound/csound · GitHub
> >> Discussions of bugs and features can be posted here
> >
> > Csound mailing list
> > Csound@listserv.heanet.ie
> > LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE
> > Send bugs reports to
> > Issues · csound/csound · GitHub
> > Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE
> Send bugs reports to
> Issues · csound/csound · GitHub
> Discussions of bugs and features can be posted here
>
well just by trial ...
instr Test
indx = 1
while indx < 10000000 do
iRnd = rnd:i1
if iRnd > .999999 then
printf_i "rnd1 = %f in cycle %d.\n", indx, iRnd, indx
endif
indx += 1
od
endin
schedule"Test",0,0
... i get this:
rnd1 = 0.999999 in cycle 4820758.
rnd1 = 1.000000 in cycle 6319223.
rnd1 = 0.999999 in cycle 7789384.
rnd1 = 1.000000 in cycle 9287849.
in other words: it takes some time, but it is not impossible.
j
Hi all,
I thought all the random number generators having range parameter in Csound return the number in closed range a <= N <= b, \[a,b\].
However, I started to feel less confident about it after checking the manual.
For example, the manual says rndx returns a random number in the unipolar range 0 to x.
Is it [0,x] or [0,x) semi\-open?
Not sure of your notation there, and one of the developers will have
to give the definitive answer, but as far as I know 'rnd10' can include
the exact output '10', not just "arbitrarily close, but never exactly...".
However, ift is really random, it might be hard to tell!
\-\- Pete \-\-
Csound mailing list
Csound@listserv.heanet.ie
LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here
Csound mailing list
Csound@listserv.heanet.ie
LISTSERV 16.5 - CSOUND List at LISTSERV.HEANET.IE
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here
Csound mailing list
Csound@listserv.heanet.ie
Send bugs reports to
Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here