[Jprogramming] Random numbers not as expected

Henry Rich henryhrich at gmail.com
Wed Dec 23 15:02:15 UTC 2020


Order of evaluation is right to left.  These are all monads.

?2, ?100, ?100

?2, ? 100 , rand0

If rand0 is 0 the next ? will return a float.

Henry Rich

On 12/23/2020 9:39 AM, emacstheviking wrote:
> Henry,
>
> I am not exactly sure what you mean but after posting I spotted that I was
> assigning type to a random value then using that as the argument to roll, I
> fixed that. If you start a jconsole session and type
>
> ?2, ?100, ?100
>
> sooner or later you get a float... placing parens. around it
>
> (?2), (?100), (?100)
>
> gives me the expected list of three integers so I guess it's to do with
> order of evaluation as roll can take one or two arguments... still learning
> J.
>
> 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



More information about the Programming mailing list