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

Dependency Diagram

graph TD
  eaf8bd1d_38bc_fc80_a638_7bdc86839405["shuffle()"]
  b685c027_c152_3cc2_bfb8_b3ba1669b231["children.spec.ts"]
  eaf8bd1d_38bc_fc80_a638_7bdc86839405 -->|defined in| b685c027_c152_3cc2_bfb8_b3ba1669b231
  style eaf8bd1d_38bc_fc80_a638_7bdc86839405 fill:#6366f1,stroke:#818cf8,color:#fff

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

Frequently Asked Questions

What does shuffle() do?
shuffle() is a function in the vue codebase, defined in test/unit/modules/vdom/patch/children.spec.ts.
Where is shuffle() defined?
shuffle() is defined in test/unit/modules/vdom/patch/children.spec.ts at line 26.

Analyze Your Own Codebase

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

Try Supermodel Free