Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
05b9c351
Commit
05b9c351
authored
Dec 03, 2003
by
Roger Dingledine
Browse files
assert that nobody asks for a random number between 0 and -1
svn:r875
parent
f65e871b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/common/crypto.c
View file @
05b9c351
...
...
@@ -1013,6 +1013,7 @@ int crypto_pseudo_rand_int(unsigned int max) {
unsigned
int
val
;
unsigned
int
cutoff
;
assert
(
max
<
UINT_MAX
);
assert
(
max
>
0
);
/* don't div by 0 */
/* We ignore any values that are >= 'cutoff,' to avoid biasing the
* distribution with clipping at the upper end of unsigned int's
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment