diff --git a/randstring.go b/randstring.go deleted file mode 100644 index 2d7096f..0000000 --- a/randstring.go +++ /dev/null @@ -1,48 +0,0 @@ -// thermal-uploader - upload thermal video recordings in CPTV format to the project's API server. -// Copyright (C) 2017, The Cacophony Project -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package main - -import ( - "math/rand" - "time" -) - -const ( - chars = "abcdefghijklmnopqrstuvwxyz0123456789" - charIdxBits = 6 // 6 bits to represent a char index - charIdxMax = 63 / charIdxBits // # of char indices fitting in 63 bits - charIdxMask = 1<= 0; { - if remain == 0 { - cache, remain = randSrc.Int63(), charIdxMax - } - if idx := int(cache & charIdxMask); idx < len(chars) { - b[i] = chars[idx] - i-- - } - cache >>= charIdxBits - remain-- - } - return string(b) -}