mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Improve the seed() builtin
Set seed() use of arc4random to same level as /dev/urandom. Restore state size for initstated random().
This commit is contained in:
6
seed.c
6
seed.c
@@ -81,7 +81,7 @@
|
|||||||
#if defined(HAVE_STDLIB_H)
|
#if defined(HAVE_STDLIB_H)
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# define RANDOM_CNT (8) /* double random() call repeat count */
|
# define RANDOM_CNT (8) /* double random() call repeat count */
|
||||||
# define INITSTATE_SIZE (16) /* initstate pool size */
|
# define INITSTATE_SIZE (256) /* initstate pool size */
|
||||||
#endif
|
#endif
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
#if defined(HAVE_URANDOM)
|
#if defined(HAVE_URANDOM)
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
# define DEV_URANDOM "/dev/urandom"
|
# define DEV_URANDOM "/dev/urandom"
|
||||||
# define DEV_URANDOM_POOL 16
|
# define DEV_URANDOM_POOL (16)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ extern char **environ; /* user environment */
|
|||||||
#endif /* HAVE_ENVIRON */
|
#endif /* HAVE_ENVIRON */
|
||||||
|
|
||||||
#if defined(HAVE_ARC4RANDOM)
|
#if defined(HAVE_ARC4RANDOM)
|
||||||
#define ARC4_BUFLEN (256)
|
#define ARC4_BUFLEN (16)
|
||||||
static char arc4_buf[ARC4_BUFLEN];
|
static char arc4_buf[ARC4_BUFLEN];
|
||||||
#endif /* HAVE_ARC4RANDOM */
|
#endif /* HAVE_ARC4RANDOM */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user