From 25df8eefcb36397a13e37063375e44103e29fc98 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Tue, 29 Sep 2020 00:17:24 +0200 Subject: [PATCH 1/9] add func to set random seed --- src/randomization/setUpRand.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/randomization/setUpRand.m diff --git a/src/randomization/setUpRand.m b/src/randomization/setUpRand.m new file mode 100644 index 0000000..c022f36 --- /dev/null +++ b/src/randomization/setUpRand.m @@ -0,0 +1,18 @@ +function [] = setUpRand() + % Set up the randomizers for uniform and normal distributions. + % It is of great importance to do this before anything else! + + seed = sum(100 * clock); + + if isOctave + + rand('state', seed); + randn('state', seed); + + else + + RandStream.setGlobalStream(RandStream('mt19937ar', 'seed', seed)); + + end + +end From 744b5e51510e99b5666fcc1c90a25f07230d30c8 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Tue, 29 Sep 2020 00:17:53 +0200 Subject: [PATCH 2/9] add documentation about random func --- docs/10_functions_description.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/10_functions_description.md b/docs/10_functions_description.md index d1d50ab..c309de3 100644 --- a/docs/10_functions_description.md +++ b/docs/10_functions_description.md @@ -26,6 +26,7 @@ - 6.1. [shuffle](#shuffle) - 6.2. [setTargetPositionInSequence](#setTargetPositionInSequence) - 6.3. [repeatShuffleConditions](#repeatShuffleConditions) + - 6.4. [setUpRand](#setUprand)