diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-06-06 08:10:08 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-06-06 08:10:08 -0700 |
| commit | 90c0aad40e9dbcfc1734f3174d6ce20625004a33 (patch) | |
| tree | f4ad603b9334dde27496f084d45b9ca1b585736d | |
| parent | 993373140212da702e1a845188cbe4dc44a76ad5 (diff) | |
| download | nng-90c0aad40e9dbcfc1734f3174d6ce20625004a33.tar.gz nng-90c0aad40e9dbcfc1734f3174d6ce20625004a33.tar.bz2 nng-90c0aad40e9dbcfc1734f3174d6ce20625004a33.zip | |
Properly constrain initial value for object IDs.
| -rw-r--r-- | src/core/objhash.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/objhash.c b/src/core/objhash.c index a25b35d9..8578307c 100644 --- a/src/core/objhash.c +++ b/src/core/objhash.c @@ -70,7 +70,8 @@ nni_objhash_init(nni_objhash **ohp, nni_objhash_ctor ctor, oh->oh_minload = 0; // never shrink below this oh->oh_minval = 1; oh->oh_maxval = 0x7fffffff; - oh->oh_dynval = nni_random(); + oh->oh_dynval = nni_random() % + (oh->oh_maxval - oh->oh_minval) + oh->oh_minval; oh->oh_ctor = ctor; oh->oh_dtor = dtor; *ohp = oh; |
