Home / Function/ shuffle() — vue Function Reference

shuffle() — vue Function Reference

Architecture documentation for the shuffle() function in children.spec.ts from the vue codebase.

Entity Profile

Relationship Graph

Source Code

test/unit/modules/vdom/patch/children.spec.ts lines 26–42

function shuffle(array) {
  let currentIndex = array.length
  let temporaryValue
  let randomIndex

  // while there remain elements to shuffle...
  while (currentIndex !== 0) {
    // pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex)
    currentIndex -= 1
    // and swap it with the current element.
    temporaryValue = array[currentIndex]
    array[currentIndex] = array[randomIndex]
    array[randomIndex] = temporaryValue
  }
  return array
}

Domain

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free