randuuid

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

README

randuuid

Build Status Go Reference

Random UUID with seed.
Source files are distributed under the BSD-style license found in the LICENSE file.

Install

go get github.com/danil/randuuid@v0.2.0

Usage

package main

import (
    "fmt"

    "github.com/danil/randuuid"
)

func main() {
    fmt.Println(randuuid.New(42))
    fmt.Println(randuuid.New(42))
}

Output:

538c7f96-b164-4f1b-97bb-9f4bb472e89f <nil>
538c7f96-b164-4f1b-97bb-9f4bb472e89f <nil>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(seed int64) (uuid.UUID, error)

New returns a Random (Version 4) UUID.

Copied from the github.com/google/uuid.

The strength of the UUIDs is based on the strength of the crypto/rand package.

A note about uniqueness derived from the UUID Wikipedia entry:

Randomly generated UUIDs have 122 random bits.  One's annual risk of being
hit by a meteorite is estimated to be one chance in 17 billion, that
means the probability is about 0.00000000006 (6 × 10−11),
equivalent to the odds of creating a few tens of trillions of UUIDs in a
year and having one duplicate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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