Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

shuffledfunction

A copy of the list in a random order (Fisher–Yates, from the end); the list given is left alone.

Import it

import { shuffled } from "@johnmorrisdotca/chizu";

Definition

function shuffled<T>(items: readonly T[], random: Random): T[]

Parameters

NameTypeDescription
itemsreadonly T[]

The input items; shuffling returns a copy.

randomRandom

A random source returning a value in [0, 1); use seededRandom for reproducible output.

Returns

T[]

A copy of the list in a random order (Fisher–Yates, from the end); the list given is left alone.

Examples

import { seededRandom, shuffled } from "@johnmorrisdotca/chizu";

const items = ["JP", "FR", "BR", "EG"];
console.log(shuffled(items, seededRandom(7)).join(" ") === shuffled(items, seededRandom(7)).join(" "), items.join(" "));
// true JP FR BR EG
true JP FR BR EG

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.