optimize pickString

pull/314/head
Darien Raymond 2016-11-06 14:04:44 +01:00
parent edc5bbbb72
commit dc0cbce6e1
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 6 additions and 2 deletions

View File

@ -35,10 +35,14 @@ func (this *Status) GetReason() string {
func pickString(arr []string) string { func pickString(arr []string) string {
n := len(arr) n := len(arr)
if n == 0 { switch n {
case 0:
return "" return ""
case 1:
return arr[0]
default:
return arr[dice.Roll(n)]
} }
return arr[dice.Roll(n)]
} }
func (this *RequestConfig) PickUri() string { func (this *RequestConfig) PickUri() string {