Shuffle II
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on May 29, 2014
An array of 200 vertical lines rotates in place to visualize a Fisher–Yates shuffle, with shuffled elements rendered in black while unshuffled ones stay light gray. The animation plays the swap sequence in reverse, shuffling the array from a fully shuffled state back to its original order. Built with D3 v3, it uses ordinal and linear scales, SVG line elements, and chained transitions to update each line’s rotation transform after every swap. The shuffle function generates random pairwise swaps, and the code references DOM nodes directly to swap their positions efficiently.
AI-generated descriptionAn improved animation of Fisher–Yates shuffle, showing the shuffled part of the array in black.
gpl-3.0 Licensed