aboutsummaryrefslogtreecommitdiff
path: root/jerry-main
diff options
context:
space:
mode:
authorDaniel Balla <dballa@inf.u-szeged.hu>2017-11-03 15:31:57 +0100
committerLászló Langó <llango.u-szeged@partner.samsung.com>2017-11-03 15:31:57 +0100
commit4690d128b344a8169fef0f9e412529d501939e4b (patch)
treefba57feb52b6bad30b87a8a9d48af58d0adde155 /jerry-main
parent678fcb20ed1355f7e55216ef8092bfaa07ed1a96 (diff)
Add info to documentation about random numbers, initialize srand (#2056)
Issue #2053 has highlighted the fact that random numbers are always generated with the same seed. An example of generating different random numbers, other than the original seed, has been added to the documentation. Furthermore srand initialization has been added to jerry-main, and targets. Update test-common.h with srand call. JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
Diffstat (limited to 'jerry-main')
-rw-r--r--jerry-main/main-unix-minimal.c1
-rw-r--r--jerry-main/main-unix.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/jerry-main/main-unix-minimal.c b/jerry-main/main-unix-minimal.c
index 87bb05f6..bb043888 100644
--- a/jerry-main/main-unix-minimal.c
+++ b/jerry-main/main-unix-minimal.c
@@ -71,6 +71,7 @@ int
main (int argc,
char **argv)
{
+ srand ((unsigned) jerry_port_get_current_time ());
if (argc <= 1 || (argc == 2 && (!strcmp ("-h", argv[1]) || !strcmp ("--help", argv[1]))))
{
print_help (argv[0]);
diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c
index e1590d00..0bfaaccc 100644
--- a/jerry-main/main-unix.c
+++ b/jerry-main/main-unix.c
@@ -424,6 +424,7 @@ int
main (int argc,
char **argv)
{
+ srand ((unsigned) jerry_port_get_current_time ());
const char *file_names[argc];
int files_counter = 0;