Skip to content

Fun bitonic sequence generator favoring cleverness over readability

Notifications You must be signed in to change notification settings

patgarcia/bitonic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

bitonic

Fun bitonic sequence generator favoring cleverness over readability

const getBitonic = (size: number): number[] =>
  size > 3
    ? [[...Array(size).keys()]]
        .map(
          (arr) =>
            arr.push(
              ...arr
                .splice(0, Math.floor(Math.random() * (size - 1)) || 1)
                .sort((a, b) => b - a)
            ) && arr
        )
        .flat()
    : [0, 2, 1];

Warning

This is just for kicks. Always favor readability.

About

Fun bitonic sequence generator favoring cleverness over readability

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published