You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
453 B
21 lines
453 B
package model |
|
|
|
import "hash/crc32" |
|
|
|
// AbTest struct |
|
type AbTest struct { |
|
ID int64 `json:"groupId"` |
|
Name string `json:"groupName"` |
|
Threshold int64 `json:"flowPercent"` |
|
ParamValues string `json:"-"` |
|
UTime int64 `json:"-"` |
|
} |
|
|
|
// AbTestIn check build in test |
|
func (ab *AbTest) AbTestIn(buvid string) (ok bool) { |
|
ration := crc32.ChecksumIEEE([]byte(buvid)) % 100 |
|
if ration < uint32(ab.Threshold) { |
|
ok = true |
|
} |
|
return |
|
}
|
|
|