|
|
|
|
|
by nbevans
3565 days ago
|
|
Math.random doesn't necessarily have side affects. If it's storing a seed value, and incrementing that each time; then yes it stores mutable state which is a side affect because future invocations of that function will then depend upon that pre-existing state. If however Math.random is passively listening for background radiation through some sensor perhaps then it doesn't really have side affects does it? Nor does it have mutable state, for that matter. But it would still be impure according the true definition of what is a pure function, I believe. |
|