pct-encoded
parent
43e48a26b7
commit
ee94c1a159
|
@ -36,6 +36,11 @@ func Password() string {
|
||||||
return Default.Password()
|
return Default.Password()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Password returns an arbitrary pct-encoded.
|
||||||
|
func PctEncoded() string {
|
||||||
|
return Default.PctEncoded()
|
||||||
|
}
|
||||||
|
|
||||||
// PhoneNumber returns an arbitrary phone‐number.
|
// PhoneNumber returns an arbitrary phone‐number.
|
||||||
//
|
//
|
||||||
// Some example phone‐number include:
|
// Some example phone‐number include:
|
||||||
|
|
|
@ -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[:])
|
||||||
|
}
|
Loading…
Reference in New Issue