dashrand

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dashrand

生成随机数据的工具

A tool that generates random data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Num

func Num[T int | int64 | float64](min, max T) T

Num @Editor robotyang at 2023

Num 生成范围内的 随机数

@Param min 下限(包含)

@Param max 上限(不包含)

@Return [min, max)

func NumSlice

func NumSlice[T int | int64 | float64](length uint, min, max T) []T

NumSlice @Editor robotyang at 2023

NumSlice 生成范围内的 随机数切片

@Param min 下限(包含)

@Param max 上限(不包含)

func Str

func Str(mode RandMode, length uint) string

Str @Editor robotyang at 2023

Str 生成随机字符串

@Param mode 字符组合模式

@Param length 要生成的字符长度

@Return str 随机字符

Types

type RandMode

type RandMode string

RandMode 组合模式

const (
	ModeNum        RandMode = "0123456789"                       //整数
	Modeaz         RandMode = "abcdefghijklmnopqrstuvwxyz"       //小写字母
	ModeAZ         RandMode = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"       //大写字母
	ModeSp         RandMode = "~!@#$%^&*()_+"                    //特殊字符
	ModeNumAlpha            = ModeNum + Modeaz + ModeAZ          //整数+小写字母+大写字母
	ModeNumAlphaSp          = ModeNum + Modeaz + ModeAZ + ModeSp //整数+小写字母+大写字母+特殊字符
)

Jump to

Keyboard shortcuts

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