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
This commit is contained in:
committed by
László Langó
parent
678fcb20ed
commit
4690d128b3
@@ -136,6 +136,7 @@ void eval_jerry_script (int argc, char *argv[], struct tcmd_handler_ctx *ctx)
|
||||
|
||||
void jerry_start ()
|
||||
{
|
||||
srand ((unsigned) jerry_port_get_current_time ());
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
jerry_value_t global_obj_val = jerry_get_global_object ();
|
||||
jerry_value_t print_func_name_val = jerry_create_string ((jerry_char_t *) "print");
|
||||
|
||||
Reference in New Issue
Block a user