Skip to main content
typo
Source Link
Adalynn
  • 6.2k
  • 1
  • 18
  • 36

APL (Dyalog Unicode), 12 9 bytes

Anonymous tacit prefix function. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems. Returns the final value (0) in addition to printing while run.

{⌊?⎕←⍵}⍣= 

Try it online!

{}⍣= apply the following function until stable:

⎕←⍵ output the argument

? return a uniformly distributed random number in the range 0 through that–1

 round down (because ?0 gives a (0,01) float)

APL (Dyalog Unicode), 12 9 bytes

Anonymous tacit prefix function. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems. Returns the final value (0) in addition to printing while run.

{⌊?⎕←⍵}⍣= 

Try it online!

{}⍣= apply the following function until stable:

⎕←⍵ output the argument

? return a uniformly distributed random number in the range 0 through that–1

 round down (because ?0 gives a (0,0) float)

APL (Dyalog Unicode), 12 9 bytes

Anonymous tacit prefix function. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems. Returns the final value (0) in addition to printing while run.

{⌊?⎕←⍵}⍣= 

Try it online!

{}⍣= apply the following function until stable:

⎕←⍵ output the argument

? return a uniformly distributed random number in the range 0 through that–1

 round down (because ?0 gives a (0,1) float)

-3
Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 293

APL (Dyalog Unicode), 1212 9 bytes

Anonymous tacit prefix function. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems. Returns the final value (0) in addition to printing while run.

{?⎕←⍵}⍣{0=⍺}⍣= 

Try it online!Try it online!

{}⍣{0=⍺}⍣= apply the following function until it returns 0stable:

⎕←⍵ output the argument

? return a uniformly distributed random number in the range 0 through that–1

 round down (because ?0 gives a (0,0) float)

APL (Dyalog Unicode), 12 bytes

Anonymous tacit prefix function. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems.

{?⎕←⍵}⍣{0=⍺} 

Try it online!

{}⍣{0=⍺} apply the following function until it returns 0:

⎕←⍵ output the argument

? return a uniformly distributed random number in the range 0 through that–1

APL (Dyalog Unicode), 12 9 bytes

Anonymous tacit prefix function. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems. Returns the final value (0) in addition to printing while run.

{?⎕←⍵}⍣= 

Try it online!

{}⍣= apply the following function until stable:

⎕←⍵ output the argument

? return a uniformly distributed random number in the range 0 through that–1

 round down (because ?0 gives a (0,0) float)

Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 293

APL (Dyalog Unicode), 12 bytes

Anonymous tacit prefix function. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems.

{?⎕←⍵}⍣{0=⍺} 

Try it online!

{}⍣{0=⍺} apply the following function until it returns 0:

⎕←⍵ output the argument

? return a uniformly distributed random number in the range 0 through that–1