Skip to main content
Code Golf

Return to Answer

deleted 24 characters in body
Source Link
Jonathan Allan
  • 114.9k
  • 8
  • 68
  • 292

Jelly, 5(削除) 5 (削除ここまで) 4 bytes

-1 thanks to Neil!

OḂịX€OịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online! Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

How?

OḂịX€OịX€ - Link: S, [C,V]
O - ordinals (of S) i.e. 'C':67 'V':86
 - least significant bit 1 0
 ị - index into [C,V] (vectorises) C V [Jelly indexing is 1-indexed and modular]
 € - for each:
 X - random choice

Jelly, 5 bytes

OḂịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

How?

OḂịX€ - Link: S, [C,V]
O - ordinals (of S) i.e. 'C':67 'V':86
 - least significant bit 1 0
 ị - index into [C,V] (vectorises) C V [Jelly indexing is 1-indexed and modular]
 € - for each:
 X - random choice

Jelly, (削除) 5 (削除ここまで) 4 bytes

-1 thanks to Neil!

OịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

How?

OịX€ - Link: S, [C,V]
O - ordinals (of S) i.e. 'C':67 'V':86
 ị - index into [C,V] (vectorises) C V [Jelly indexing is 1-indexed and modular]
 € - for each:
 X - random choice
added 311 characters in body
Source Link
Jonathan Allan
  • 114.9k
  • 8
  • 68
  • 292

Jelly, 5 bytes

OḂịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

How?

OḂịX€ - Link: S, [C,V]
O - ordinals (of S) i.e. 'C':67 'V':86
 Ḃ - least significant bit 1 0
 ị - index into [C,V] (vectorises) C V [Jelly indexing is 1-indexed and modular]
 € - for each:
 X - random choice

Jelly, 5 bytes

OḂịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

Jelly, 5 bytes

OḂịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

How?

OḂịX€ - Link: S, [C,V]
O - ordinals (of S) i.e. 'C':67 'V':86
 Ḃ - least significant bit 1 0
 ị - index into [C,V] (vectorises) C V [Jelly indexing is 1-indexed and modular]
 € - for each:
 X - random choice
added 92 characters in body
Source Link
Jonathan Allan
  • 114.9k
  • 8
  • 68
  • 292

Jelly, 5 bytes

OḂịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

Jelly, 5 bytes

OḂịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

Jelly, 5 bytes

OḂịX€

A dyadic Link accepting a list of characters, S, on the left and a list of two lists of characters, [C, V], on the right which yields a list of characters.

Try it online!

If we could take S as a list of 1s and 0s we'd have the three byte solution ịX€.

added 1 character in body
Source Link
RGS
  • 14.2k
  • 1
  • 61
  • 117
Loading
Source Link
Jonathan Allan
  • 114.9k
  • 8
  • 68
  • 292
Loading

AltStyle によって変換されたページ (->オリジナル) /