Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

66%
+2 −0
Challenges Shuffle a subset of a list

Jelly, 7 bytes œPżịẊ¥F Try it online! Takes the 1-indexed indices on the left and the list on the right How it works œPżịẊ¥F - Main link. Takes I on the left and L on the right œP - Pa...

posted 3y ago by caird coinheringaahing‭  ·  edited 3y ago by caird coinheringaahing‭

Answer
#2: Post edited by user avatar caird coinheringaahing‭ · 2021-07-01T23:00:03Z (over 3 years ago)
  • # [Jelly], 7 bytes
  • œPżịẊ¥F
  • [Try it online!][TIO-kqli98vn]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kqli98vn]: https://tio.run/##y0rNyan8///o5ICjex7u7n64q@vQUrf/jxpmHF6udHTSw50zHjWtifz/P9pAx1DHSMdYx0THVMcsVkcBKGAE5ECZIHELHcvY/9FIqnTMQZIYApbGQJYh2DwDAx0TQx1zCx1jQx1jEx0j81gA "Jelly – Try It Online"
  • # [Jelly], 7 bytes
  • œPżịẊ¥F
  • [Try it online!][TIO-kqli98vn]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kqli98vn]: https://tio.run/##y0rNyan8///o5ICjex7u7n64q@vQUrf/jxpmHF6udHTSw50zHjWtifz/P9pAx1DHSMdYx0THVMcsVkcBKGAE5ECZIHELHcvY/9FIqnTMQZIYApbGQJYh2DwDAx0TQx1zCx1jQx1jEx0j81gA "Jelly – Try It Online"
  • Takes the 1-indexed indices on the left and the list on the right
  • ## How it works
  • œPżịẊ¥F - Main link. Takes I on the left and L on the right
  • œP - Partition L after the indices in I, removing the borders
  • ¥ - Group the previous 2 links as a dyad f(I, L):
  • ị - Get the elements of L at the indices in I
  • Ẋ - Shuffle uniformly
  • ż - Zip
  • F - Flatten
#1: Initial revision by user avatar caird coinheringaahing‭ · 2021-07-01T22:54:45Z (over 3 years ago)
# [Jelly], 7 bytes

    œPżịẊ¥F

[Try it online!][TIO-kqli98vn]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kqli98vn]: https://tio.run/##y0rNyan8///o5ICjex7u7n64q@vQUrf/jxpmHF6udHTSw50zHjWtifz/P9pAx1DHSMdYx0THVMcsVkcBKGAE5ECZIHELHcvY/9FIqnTMQZIYApbGQJYh2DwDAx0TQx1zCx1jQx1jEx0j81gA "Jelly – Try It Online"