ocket8888 commented on code in PR #6852:
URL: https://github.com/apache/trafficcontrol/pull/6852#discussion_r892605455
##########
traffic_ops/traffic_ops_golang/test/rand.go:
##########
@@ -36,3 +38,68 @@ func RandStrArray() []string {
}
return sArray
}
+
+func RandBool() *bool {
+ b := rand.Int()%2 == 0
+ return &b
+}
+
+func RandInt() *int {
+ i := rand.Int()
+ return &i
+}
+func RandInt64() *int64 {
+ i := rand.Int63()
+ return &i
+}
+
+func RandUint64() *uint64 {
+ i := uint64(rand.Int63())
+ return &i
+}
+
+func RandUint() *uint {
+ i := uint(rand.Int())
+ return &i
+}
+
+func RandIntn(n int) *int {
+ i := rand.Intn(n)
+ return &i
+}
+
+func RandFloat64() *float64 {
+ f := rand.Float64()
+ return &f
+}
+
+func RandomIPv4() *string {
+ first := rand.Int31n(256)
+ second := rand.Int31n(256)
+ third := rand.Int31n(256)
+ fourth := rand.Int31n(256)
+ str := fmt.Sprintf("%d.%d.%d.%d", first, second, third, fourth)
+ return &str
+}
+
+func RandomIPv6() *string {
+ ip := net.IP([]byte{
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ uint8(rand.Int31n(256)),
+ }).String()
+ return &ip
+}
Review Comment:
I don't know how this got in here again. It's clearly already been in a
review, and in fact already resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]