Regarding your question: Why do I use the same sequence of random variables?

Well, when I first ran your program a couple of times, I got different results each time. Exactly as you'd expect from a program using some random numbers.

However, I was playing with the program, I couldn't be certain I haven't broken the code. After all, I wouldn't know what values should come out. So it would be easy for me to introduce an error without noticing it. So I told the program to use the same random numbers each time. That way, I could make a change and run the program. If the output was the same, I probably didn't break it. Then I could move on to the next change. If the output was different, though, I could immediately identify (1) that I introduced an error, and (2) the error was between the last two runs. So I just keep the code in one window, and run the program in another window. That way, I could run the program after each significant change.

It may be helpful to you for debugging to use the same sequence of random numbers: You could play along by hand with a calculator and verify that the numbers are working the way you want them to. If you find an error, you can correct it, and then run it again and verify that the correction did what you wanted, without having to kill your fingers and your calculator by starting over with a new set of numbers....

Of course, once you get the code working, you switch back to normal random numbers.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re^3: Simulating uni-dimensional Hawkes processes by roboticus
in thread Simulating uni-dimensional Hawkes processes by glrm_master

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.