# Random number generation

**URL:** <https://discourse.julialang.org/t/random-number-generation/110010>\
**Category:** General Usage\
**Tags:** question, random\
**Created:** [February 9, 2024, 8:27pm UTC](https://discourse.julialang.org/t/random-number-generation/110010 "2024-02-09T20:27:03Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [February 10, 2024, 7:48pm UTC](https://discourse.julialang.org/t/random-number-generation/110010/17 "2024-02-10T19:48:30Z")

</div>

The “official” interpretation is that `read(io)` doesn’t mutate `io`. It’s the state of the world that changed, not the `io` object.

> I favor a somewhat larger conception of “publicly visible” than that.

That’s fine, but the Julia designers had to draw the line somwhere on what is explicit state and what is implicit state. There’s always going to be examples where one could argue whether that line might have been better moved a bit in one direction or the other. In some sense, _every_ function mutates, since it changes the content of your RAM or at least the registers in the CPU.

Functional languages like Haskell tend to draw the line for what is explicit state a lot closer and probably would support that `read(io)` should be considered mutating. But fundamentally, it’s a language design decision, and [Julia is not at that stage of development anymore](https://discourse.julialang.org/t/psa-julia-is-not-at-that-stage-of-development-anymore/44872). So the semantics or name of `read` isn’t going to change.

Personally, I find the decisions that were made for Julia quite sensible, but it’s hard to argue if your intuition is different (maybe because you’re coming from a more functional language background?)

---

_[View the full topic](https://discourse.julialang.org/t/random-number-generation/110010)._
