Are you SURE that value of stargen matches the printed results?

Henry Rich

On 12/23/2020 9:14 AM, emacstheviking wrote:
I am confused as to why trying to return a list of random numbers produces
floating point values now and then, seemingly random! :D
Passing >0 is, as I understand it, a half-open interval, as an integer so
why the floats?

stargen=: 3 : 0
'maxx maxy'=.y
smoutput 'maxx:',(":maxx),' maxy:',(":maxy)
type=. ?2
x=. ?maxx
y=. ?maxy
NB.type,x,y
(?type),(?maxx),(?maxy)
)

As it stands, I get output like this:

    stargen 3;3
maxx:3 maxy:3
0 2 2
    stargen 3;3
maxx:3 maxy:3
1 0.0847742 0
    stargen 3;3
maxx:3 maxy:3
0 0 0.941037
    stargen 3;3
maxx:3 maxy:3
0.719078 2 0
    stargen 3;3
maxx:3 maxy:3

But when I exchange the last line for the commented out line I always get
whole numbers (or so I have been lucky so far)... what did I do wrong? The
code may look odd but it's because it's in the middle of a trial-and-error
process.
Thanks.
Sean.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to