Browse Source

Fix condition; remove unreachable panic.

Dmitry Chestnykh 11 years ago
parent
commit
997004be41
1 changed files with 1 additions and 2 deletions
  1. 1 2
      random.go

+ 1 - 2
random.go

@@ -78,7 +78,7 @@ func randomBytesMod(length int, mod byte) (b []byte) {
 	for {
 	for {
 		r := randomBytes(length + (length / 4))
 		r := randomBytes(length + (length / 4))
 		for _, c := range r {
 		for _, c := range r {
-			if c >= maxrb {
+			if c > maxrb {
 				// Skip this number to avoid modulo bias.
 				// Skip this number to avoid modulo bias.
 				continue
 				continue
 			}
 			}
@@ -89,7 +89,6 @@ func randomBytesMod(length int, mod byte) (b []byte) {
 			}
 			}
 		}
 		}
 	}
 	}
-	panic("unreachable")
 }
 }
 
 
 // randomId returns a new random id string.
 // randomId returns a new random id string.