I am trying to run a simple sim that I have done a million times. simulate three dice and take the sum. For some reason when I am assigning my code to a variable it keeps returning the same value over and over. I have cleared my environment and set.seed is not being used. my code is simple
Can you provide a full reproducible example of all the code you're running? Also, to simulate rolling three six-sided dice, the code would be sum(sample(1:6, 3, replace=TRUE)).
every time i run sim it returns the same number. Then if i take a break and try again it returns a different number over and over. I cleared history and environment and that is the only thing in my rmd.
Its storing it as a value, do I need to make it a function?
edit.
Ive just seen that you expectation is that you would type sim, and see a different number, but as you say its not a function, so it would just show the stored value
so it seems you want