Skip to main content
added 52 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

JaptJapt, 7 bytes7 6 bytes

ËÆDcÈÇX
c ö

Test it here


Explanation

Implicit input of array U.

Ë

Map over the array passing each element through a function where D is the current element.Try it

ÆDcÈÇX\nö     :Implicit input of array U

Generate an array of length D and fill it with D.

c           :Flat map by

Flatten.

 È          :Passing each X through the following function
  ÇX        :  Map the range [0,X) to X
    \n      :Reassign to U
      ö     :Random element

Get a random element.

Japt, 7 bytes

ËÆD
c ö

Test it here


Explanation

Implicit input of array U.

Ë

Map over the array passing each element through a function where D is the current element.

ÆD

Generate an array of length D and fill it with D.

c

Flatten.

ö

Get a random element.

Japt, 7 6 bytes

cÈÇX
ö

Try it

cÈÇX\nö     :Implicit input of array U
c           :Flat map by
 È          :Passing each X through the following function
  ÇX        :  Map the range [0,X) to X
    \n      :Reassign to U
      ö     :Random element
Commonmark migration
Source Link

#Japt, 7 bytes

Japt, 7 bytes

ËÆD
c ö

Test it here


Explanation

##Explanation ImplicitImplicit input of array U.

Ë

Map over the array passing each element through a function where D is the current element.

ÆD

Generate an array of length D and fill it with D.

c

Flatten.

ö

Get a random element.

#Japt, 7 bytes

ËÆD
c ö

Test it here


##Explanation Implicit input of array U.

Ë

Map over the array passing each element through a function where D is the current element.

ÆD

Generate an array of length D and fill it with D.

c

Flatten.

ö

Get a random element.

Japt, 7 bytes

ËÆD
c ö

Test it here


Explanation

Implicit input of array U.

Ë

Map over the array passing each element through a function where D is the current element.

ÆD

Generate an array of length D and fill it with D.

c

Flatten.

ö

Get a random element.

deleted 2 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#Japt, 7 bytes

ËÆD
c ö

Test it here


##Explanation Implicit input of array U.

Ë

Map over therethe array passing each element through a function where D is the current element.

ÆD

Generate an array of length D and fill it with D.

c

Flatten.

ö

Get a random element.

#Japt, 7 bytes

ËÆD
c ö

Test it here


##Explanation Implicit input of array U.

Ë

Map over there array passing each element through a function where D is the current element.

ÆD

Generate an array of length D and fill it with D.

c

Flatten.

ö

Get a random element.

#Japt, 7 bytes

ËÆD
c ö

Test it here


##Explanation Implicit input of array U.

Ë

Map over the array passing each element through a function where D is the current element.

ÆD

Generate an array of length D and fill it with D.

c

Flatten.

ö

Get a random element.

added 68 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
added 261 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading