Skip to main content
Commonmark migration
Source Link

Dyalog APL, 8 bytes

/⍨⌷⍨1?+/

Try it online!

##How?

How?

  • /⍨, n copies of n for each n in the argument.
  • ⌷⍨, at the index of
  • 1?, a random value between 1 and
  • +/, the sum of the argument

Dyalog APL, 8 bytes

/⍨⌷⍨1?+/

Try it online!

##How?

  • /⍨, n copies of n for each n in the argument.
  • ⌷⍨, at the index of
  • 1?, a random value between 1 and
  • +/, the sum of the argument

Dyalog APL, 8 bytes

/⍨⌷⍨1?+/

Try it online!

How?

  • /⍨, n copies of n for each n in the argument.
  • ⌷⍨, at the index of
  • 1?, a random value between 1 and
  • +/, the sum of the argument
Source Link
Adalynn
  • 6.2k
  • 1
  • 17
  • 36

Dyalog APL, 8 bytes

/⍨⌷⍨1?+/

Try it online!

##How?

  • /⍨, n copies of n for each n in the argument.
  • ⌷⍨, at the index of
  • 1?, a random value between 1 and
  • +/, the sum of the argument