https://github.com/jsoftware/jsource/blob/master/jsrc/vrand.c#L789
-- Raul On Wed, Jun 14, 2023 at 8:31 PM 'Pascal Jasmin' via Source <sou...@jsoftware.com> wrote: > > There would be a non 0 probability of duplicates high enough to occur to > someone in next 50 years. > An algortithm that keeps the randomness generator of keeping the first > selection intact in a deal that is perhaps useful at least when there is low > probability of duplicates: > > ( ] (<@] (,~<) i.@#@] + {~) L:0 a:"_`(<@I.)@.(1 < +/)"1@:=(-.&a:@:)) 2 3 2 3 > 4 5 2 > > ┌─────────────┬─────────┐ > > │┌─────┬─────┐│┌───┬───┐│ > > ││2 3 4│0 2 6│││3 4│1 3││ > > │└─────┴─────┘│└───┴───┘│ > > └─────────────┴─────────┘ > > > > finds repeated indexes and increments replacements for duplicates, joins the > replacement and indexes in overall box, suitable for amendv verb below to > scan/ replace all duplicates. Recursively applies (^:_) until no duplicates > remain. > > > > amendve =: 4 : 0 :: ] NB. x is boxed or itemed to be replace_values,indexes. > y is data to amend. > > 'a b' =. x > > a b}y > > ) > > amendv =: amendve :: ] NB. error no change useful for J corner cases in > building empty x > > > > > > > > dealx =: 4 : '(<@] (,~ |.) ] (<@] (,~<) i.@#@] (y | +) {~) L:0 > a:"_`(<@I.)@.(1 < +/)"1@:=(-.&a:@:))(amendv each/@:)(>@)^:_ x ?@:# y' > > > 14 dealx 14 > 9 2 1 12 13 8 10 6 11 0 3 4 5 7 > > 2 dealx 2980293480239480239480239480239480239482039x > > 2944004533308676397283493309982083700473234 > 612729966346708897309198185520497570771366 > > > On Wednesday, June 14, 2023 at 04:52:12 p.m. EDT, Henry Rich > <henryhr...@gmail.com> wrote: > > As a workaround, if you just roll 5 numbers from that domain you will get > the right answer. That might be an acceptable 'fix' for the source code too. > > Henry Rich > > On Wed, Jun 14, 2023, 10:46 PM Henry Rich <henryhr...@gmail.com> wrote: > > > The i0 gives domain error if the argument exceeds IMAX, which is what you > > are seeing. This looks like a bug to me. I think the algorithm for deal > > would work if you just called roll with the extended arguments. Raul, would > > you like to take that on? > > > > Henry Rich > > > > On Wed, Jun 14, 2023, 6:53 PM Raul Miller <rauldmil...@gmail.com> wrote: > > > >> This error is coming from > >> > >> #0 jtjsignal (jt=0x7ffff7fc0200, e=3) at ../../../../jsrc/d.c:361 > >> #1 0x00007ffff34b131a in jtcvt () from > >> /mnt/c/cygwin64/home/15712/jsoftware/jsource/bin/linux/j64avx2/libj.so > >> #2 0x00007ffff350173e in jtvi (jt=0x7ffff7fc0200, w=0x4b4000) at > >> ../../../../jsrc/u.c:570 > >> #3 0x00007ffff3501562 in jti0 (jt=0x7ffff7fc0200, w=0x4b4000) at > >> ../../../../jsrc/u.c:238 > >> #4 0x00007ffff36fa6a1 in jtdeal (jt=0x7ffff7fc0200, a=0x7ffff3a3a680 > >> <Bnum+1088>, w=0x4b4000, > >> self=0x7ffff3a3b8c0 <primtab+2176>) at ../../../../jsrc/vrand.c:794 > >> > >> The issue seems to be the second i0 here > >> > >> RE(m=i0(a)); RE(c=n=i0(w)); // c starts as max#+1 > >> > >> In u.c, the comment on i0 is: > >> > >> // Extract the integer value from w, return it. Set error if > >> non-integral or non-atomic. Values whose abs > IMAX are converted to > >> IMAX/-IMAX > >> > >> I haven't yet figured out what's wrong with jti0 in this instance. > >> > >> FYI, > >> > >> -- > >> Raul > >> > >> On Wed, Jun 14, 2023 at 11:54 AM 'Veter Kamenev' via Beta > >> <b...@jsoftware.com> wrote: > >> > > >> > Hi! > >> > > >> > 5 ? 2980293480239480239480239480239480239482039x > >> > > >> > |domain error, executing dyad ? > >> > |y must be a positive integer > >> > > >> > I read in NuVoc: > >> > > >> > y range of random number > >> > 0 floating-point value in interval (0,1) > >> > 1 0 (always) > >> > 2 Boolean > >> > >1 integer or extended integer from list i.y > >> > > >> > https://code.jsoftware.com/wiki/Vocabulary/query#dyadic > >> > > >> > Best wishes, > >> > Veter > >> > ---------------------------------------------------------------------- > >> > For information about J forums see http://www.jsoftware.com/forums.htm > >> ---------------------------------------------------------------------- > >> For information about J forums see http://www.jsoftware.com/forums.htm > >> > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm