bogo

package module
v0.0.0-...-97f9623 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 3 Imported by: 0

README

gobogo

Go Report Card Go Reference Test

This package provides an implementation of bogosort for the Go programming language that usees the generics feature introduced in Go 1.18.

Installation

go get -u github.com/BenJetson/gobogo

Example

package main

import (
	"fmt"

	bogo "github.com/BenJetson/gobogo"
)

func main() {
	s := []int{5, 1, 9, 8, 3, 6, 2, 4, 7}
	fmt.Println("input:", s) // unsorted.
	bogo.Sort(s)
	fmt.Println("output:", s) // (eventually) sorted!
}

You can try it on the Go Playground!

Usage

I wouldn't recommend using this package, but documentation is available if you would like to do so.

All usage is subject to the terms of the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSorted

func IsSorted[T cmp.Ordered](s []T) bool

IsSorted determines whether or not the input slice is sorted or not.

func Shuffle

func Shuffle[T cmp.Ordered](s []T)

Shuffle performs an in-place randomization of the given slice, swapping somewhere between 0.5 and 1.5 times the number of elements in the slice.

func Sort

func Sort[T cmp.Ordered](s []T)

Sort accepts a slice of any ordered type and performs an in-place sort of the data using the bogosort algorithm.

If you call this function, good luck.

Types

This section is empty.

Directories

Path Synopsis
cmd
example command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL