pct-encoded

master
Charles Iliya Krempeaux 2024-08-25 05:47:26 -07:00
parent 43e48a26b7
commit ee94c1a159
2 changed files with 22 additions and 0 deletions

View File

@ -36,6 +36,11 @@ func Password() string {
return Default.Password()
}
// Password returns an arbitrary pct-encoded.
func PctEncoded() string {
return Default.PctEncoded()
}
// PhoneNumber returns an arbitrary phonenumber.
//
// Some example phonenumber include:

17
t_pctencoded.go 100644
View File

@ -0,0 +1,17 @@
package arbitrary
var hexdigs []byte = []byte{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}
// PctEncoded returns an arbitrary pct-encoded.
func (arb T) PctEncoded() string {
var buffer [3]byte
buffer[0] = '%'
var length int = len(hexdigs)
buffer[1] = hexdigs[arb.randomness.Intn(length)]
buffer[2] = hexdigs[arb.randomness.Intn(length)]
return string(buffer[:])
}