The highest tagged major version is
v2 .
Discover Packages
github.com/gogf/gf
util
grand
package
Version:
v1.11.1
Opens a new window with list of versions in this module.
Published: Jan 7, 2020
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 59
Opens a new window with list of known importers.
Documentation Source Files Overview Index Constants Variables Functions Types Digits(n) Intn(max) Letters(n) Meet(num, total) MeetProb(prob) N(min, max) Perm(n) Str(n)
Documentation
¶
Package grand provides high performance random string generation functionality.
Digits returns a random string which contains only digits, and its length is <n>.
Intn returns a int number which is between 0 and max - [0, max).
Note:
1. The <max> can only be geater than 0, or else it return <max> directly;
2. The result is greater than or equal to 0, but less than <max>;
3. The result number is 32bit and less than math.MaxUint32.
Letters returns a random string which contains only letters, and its length is <n>.
Meet randomly calculate whether the given probability <num>/<total> is met.
MeetProb randomly calculate whether the given probability is met.
N returns a random int between min and max - [min, max].
The <min> and <max> also support negative numbers.
Perm returns, as a slice of n int numbers, a pseudo-random permutation of the integers [0,n).
Str returns a random string which contains digits and letters, and its length is <n>.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.