Generates a random alphanumeric string of a given length.

randstring

randstring.Create () is fast and has minimal memory allocation. It returns a random alphanumeric string of a given length.

Install

go get github.com/kaibox-git/randstring

Usage

import "github.com/kaibox-git/randstring"

...

for i:=0; i<3; i++{
    s := randstring.Create(32)
    println(s)
}

Example output:

drJEmUtKP9MDqlht50UBphGgPlDPypxJ
CAGukS8enZvT2d7a2VpqEzdqz8aCEceS
cIWj07dy3tk7Lc6i1e88TGWjX2N0Z2d1

Benchmarks

See benchmark details in randstring_test.go

BenchmarkCreate-8               	 7968715	       141.2 ns/op	      32 B/op	       1 allocs/op
BenchmarkRandStr-8              	 7608330	       161.9 ns/op	      32 B/op	       1 allocs/op
BenchmarkMake-8                 	 6583093	       185.8 ns/op	      32 B/op	       1 allocs/op
BenchmarkGenerate-8             	 1575364	       778.5 ns/op	      32 B/op	       1 allocs/op
BenchmarkRandomBase64String-8   	 1228260	       936.3 ns/op	     128 B/op	       3 allocs/op
BenchmarkRandSeq-8              	  995644	      1182 ns/op	     176 B/op	       2 allocs/op
BenchmarkRandString-8           	  122017	      9434 ns/op	     120 B/op	       3 allocs/op
Similar Resources

Just some random matchers

Just some random matchers

The package provides a matcher interface to match a given value of any types.

Nov 3, 2022

generate random data like name, email, uuid, address, images and etc.

gg-rand generate random data like name, email, uuid, address, images and etc. build and install: make run: gg-rand $ gg-rand SillyName : Knavesa

Nov 16, 2022

Generate some random data

fake-data-generator-api generate some random data installing and using

Dec 2, 2022

GoApiRandom - Api to get random numbers

GoApiRandom - Api to get random numbers

Jan 18, 2022

Print random bytes from a secure source to stdout.

Print random bytes from a secure source to stdout.

Feb 11, 2022

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al.

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al.

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al. This library is external dependency-free. It only depends on the Go standard library.

Dec 27, 2022

Package strnaming is used to Convert string to camelCase, snake_case, kebab-case.

strnaming Package strnaming is used to Convert string to camelCase, snake_case, kebab-case. Contents strnaming Contents API Examples Install Quick sta

Oct 24, 2021

💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more.

💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more.

💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more. Go 的一些工具函数,格式化,特殊处理,常用信息获取等等

Jan 6, 2023

encLib is a simple golang package for quickly encoding and decoding string data in hex

encLib is a simple golang package for quickly encoding and decoding string data in hex

Nov 1, 2021
Vex is a variable-length, lexicographically-sortable hex format for uint64 values

Vex is a variable-length, lexicographically-sortable hex format for uint64 values. It can be used instead of fmt.Sprintf("%016x", v) for shorter s

Mar 3, 2022
Code generator that generates boilerplate code for a go http server

http-bootstrapper This is a code generator that uses go templates to generate a bootstrap code for a go http server. Usage Generate go http server cod

Nov 20, 2021
A protoc plugin that generates fieldmask paths as static type properties for proto messages

protoc-gen-fieldmask A protoc plugin that generates fieldmask paths as static ty

Nov 3, 2022
A Go library for calculating the sunset/sunrise time from a given location.

solar A library for calculating the sunset/sunrise time from a given location, as well as a function to calculate the whitepoint. It is a port of ~ken

Nov 28, 2021
Returns an array of Philippine zipcode details given a search key

Returns an array of Philippine zipcode details given a search key

Jan 20, 2022
randstr is a module that contains functions for generating random strings.

randstr is a module that contains functions for generating random strings. The functions in this module uses the crypto/rand package. Installa

Nov 13, 2021
Fast, scalable pseudo random number generator based on xxh3
Fast, scalable pseudo random number generator based on xxh3

XXH3-Based Pseudorandom Number Generator This package contains an experimental implementation of a noise based pseudorandom number generator that scal

Nov 24, 2022
Daypaper sets your GNOME wallpaper based on the time of day from a random and relevant Unsplash image.

Daypaper Daypaper sets your GNOME wallpaper based on the time of day from a random and relevant Unsplash image. Installation You will need an Access T

May 23, 2022
✔️ Get random data for your app from a third-party source.

Random Data Securely produced random data for application testing. FAQ What would i use this data for? You can use this information to test your apps

Jul 5, 2022
Encriptator using random generated numbers

public-private-key-encrypter Encriptator using random generated numbers The input file must be in one file called 'data.txt' The execution will genera

Oct 15, 2021