Commit Graph

43 Commits

Author SHA1 Message Date
Dmitry Chestnykh
46cf8faafd Make sure there are at least 2 chars in charset. 2015-04-04 00:45:19 +02:00
Dmitry Chestnykh
d7c89a5f19 Merge pull request #9 from argusdusty/patch-1
Correct for bias towards first character in chars
2015-04-04 00:38:26 +02:00
Mark Canning
2e215562f6 Correct for bias towards first character in chars
Currently the first character in chars has a 1/clen + 1/(maxrb+1) chance of being selected. In the case of StdChars the first character is ~25% more likely to be picked than any other character. This change gives a 1/clen chance to all characters, and is based on math/rand's Int31n(n).
2015-04-03 15:07:17 -07:00
Dmitry Chestnykh
87c54b9ba5 Move allocations later in the function. 2015-01-21 21:40:45 +01:00
Dmitry Chestnykh
69450cc2a9 Simplify: use rand.Read instead of io.ReadFull. 2015-01-21 21:36:57 +01:00
Dmitry Chestnykh
c1f1da6c92 Fix allowed characters test. 2015-01-21 19:39:59 +01:00
Dmitry Chestnykh
45d4bb4e8f Merge pull request #8 from StableLib/zerolength
Fix hanging when requested zero-length string.
2015-01-21 19:32:26 +01:00
Dmitry Chestnykh
7668ee6861 Fix hanging when requested zero-length string.
Add test for NewLen from 0 to 100.
2015-01-21 18:36:13 +01:00
Dmitry Chestnykh
e80eb311f3 Merge pull request #7 from StableLib/fixes
Apply fixes to README.
2015-01-21 10:17:03 +01:00
Dmitry Chestnykh
6bf29ee29b Apply fixes to README. 2015-01-21 10:16:15 +01:00
Dmitry Chestnykh
29588318d5 Merge pull request #6 from StableLib/fixes
Fixes
2015-01-21 10:14:28 +01:00
Dmitry Chestnykh
e12eafb5ea Follow proper documentation style. 2015-01-21 10:10:00 +01:00
Dmitry Chestnykh
d22ce09b5b Fix test: wrong arguments order for format string.
Also, remove unnecessary second argument in for loop.
2015-01-21 10:07:48 +01:00
Dmitry Chestnykh
b317a711d1 Fix a typo. 2015-01-21 10:05:44 +01:00
Dmitry Chestnykh
d4cd796fc0 Merge pull request #5 from StableLib/go12
Drop support for Go 1.0 and 1.1.
2015-01-21 09:56:23 +01:00
Dmitry Chestnykh
131ec1e531 Drop support for Go 1.0 and 1.1.
Add Travis testing on 1.4.
2015-01-21 09:48:39 +01:00
Dmitry Chestnykh
dc985c3409 Travis-CI: add go1.3. 2014-11-10 11:43:08 +01:00
Dmitry Chestnykh
ab403cc24d Use SVG image for Travis status. 2014-11-06 23:14:39 +01:00
Dmitry Chestnykh
76c2ebb03e Drop MIT license, put code into public domain/CC0. 2014-11-06 23:13:45 +01:00
Dmitry Chestnykh
9eb2cf0919 Simplify. 2014-08-09 17:13:26 +02:00
Dmitry Chestnykh
29a0069dc7 Better var name to avoid confusion with type name. 2014-08-09 17:05:33 +02:00
Dmitry Chestnykh
b09047d1ee Fix for alphabets of 256 characters.
Also, panic if given more.
2014-08-09 17:03:38 +02:00
Dmitry Chestnykh
7dd3037eec Merge branch 'morhekil-master' 2014-08-09 15:58:23 +02:00
Oleg Ivanov
1b691aeab2 fixed an endless loop when length of chars is a divisor of 256 2014-08-09 23:08:44 +10:00
Dmitry Chestnykh
bc4af7603a Add go1.2 to .travis.yml 2013-12-23 09:21:49 +01:00
Dmitry Chestnykh
aa75fb5575 Add .travis.yml and Travis-CI badge to README. 2013-12-12 18:04:03 +01:00
Dmitry Chestnykh
6004a1368e Revert "Remove panic not needed since Go 1.1."
This reverts commit 53e2fd7421.
2013-12-12 18:01:04 +01:00
Dmitry Chestnykh
53e2fd7421 Remove panic not needed since Go 1.1. 2013-09-23 18:48:36 +02:00
Dmitry Chestnykh
24c0a03472 Delete .gitignore
Leftover from the days when Go programs were built with Makefiles.
2013-09-23 18:44:53 +02:00
Dmitry Chestnykh
9727604170 Merge pull request #1 from adeven/readme_syntax_highlighting
Use fenced code blocks to enabled golang syntax highlighting in README.md
2013-09-23 09:39:42 -07:00
Christian Wellenbrock
3c1e943e8d Use fenced code blocks to enabled golang syntax highlighting in README.md 2013-09-23 18:32:11 +02:00
Dmitry Chestnykh
586d18d326 Remove Makefile. Use go tool.
Go weekly.2012-02-07.
2012-02-09 19:54:26 +01:00
Dmitry Chestnykh
97550955b0 Style fix. 2012-01-20 15:24:58 +01:00
Dmitry Chestnykh
00f2f1a9e4 Fix for Go weekly.2012-01-15. 2012-01-16 14:29:26 +01:00
Dmitry Chestnykh
958b406e0e Avoid modulo bias. 2011-06-06 14:34:01 +02:00
Dmitry Chestnykh
ecf15fa52a Add .gitignore 2011-04-16 23:38:26 +02:00
Dmitry Chestnykh
455ea53f19 Replace README with markdown version. 2011-04-16 21:39:53 +02:00
Dmitry Chestnykh
e810e021c7 Use io.ReadFull to read from random source. 2011-04-05 21:52:50 +02:00
Dmitry Chestnykh
6c4e68eee9 Move 0 to position before 1. 2011-04-05 21:48:27 +02:00
Dmitry Chestnykh
7f58d67fe3 Simplify reading from rand. 2011-04-05 20:37:41 +02:00
Dmitry Chestnykh
23e72bb56d Update README. 2011-04-05 19:56:42 +02:00
Dmitry Chestnykh
5abb82120b Fix docs. 2011-04-05 19:55:23 +02:00
Dmitry Chestnykh
4bfaae0c47 Initial commit. 2011-04-05 17:57:25 +02:00