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
  5d03f273_d0ca_e8e6_71ae_24ef6619ed74["shuffle()"]
  93d303a6_2add_e8cc_597e_c6677bc4fe2f["children.spec.ts"]
  5d03f273_d0ca_e8e6_71ae_24ef6619ed74 -->|defined in| 93d303a6_2add_e8cc_597e_c6677bc4fe2f
  style 5d03f273_d0ca_e8e6_71ae_24ef6619ed74 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