cpp-lln-lab / CPP_PTB

a set of function to make it easier to create behavioral, EEG, fMRI experiment with psychtoolbox
https://cpp-ptb.readthedocs.io/en/latest/index.html#
MIT License
14 stars 13 forks source link

create function to initialize RNG seed - must work both for matlab (including "old" versions) AND octave #95

Closed Remi-Gau closed 4 years ago

Remi-Gau commented 4 years ago

I had this function somewhere else but I think this is not ideal

function [] = setUpRand()
    % Set up the randomizers for uniform and normal distributions.
    % It is of great importance to do this before anything else!
    rand('state', sum(100, clock));
    randn('state', sum(100, clock));
end

@marcobarilari I think this is much more your area of expertise than mine. Can I assign you to this?

Having one function we can reuse across all projects would be super useful.

And also we actually need it for our localizers I think.

marcobarilari commented 4 years ago

you mean that I am too way random??

I know this one but I do not remember whether it may have some problem with octave, I'll check

RandStream.setGlobalStream(RandStream('mt19937ar','seed',sum(100*clock)));

Remi-Gau commented 4 years ago

you mean that I am too way random??

That's exactly what I mean ! :rofl:

I know this one but I do not remember whether it may have some problem with octave, I'll check

RandStream.setGlobalStream(RandStream('mt19937ar','seed',sum(100*clock)));

ok cool let me know what you find.