# SE-0202 Amendment Proposal: Rename Random to DefaultRandomNumberGenerator

**URL:** <https://forums.swift.org/t/se-0202-amendment-proposal-rename-random-to-defaultrandomnumbergenerator/12942>\
**Category:** Proposal Reviews\
**Created:** [May 24, 2018, 3:48pm UTC](https://forums.swift.org/t/se-0202-amendment-proposal-rename-random-to-defaultrandomnumbergenerator/12942 "2018-05-24T15:48:18Z")\
**Posts on this page:** 1\
**Showing post:** 46

<div class="post-metadata">

**Author:** ![palimondo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/palimondo/32/1144_2.png) [@palimondo](https://forums.swift.org/u/palimondo)\
**Post date:** [May 25, 2018, 9:56am UTC](https://forums.swift.org/t/se-0202-amendment-proposal-rename-random-to-defaultrandomnumbergenerator/12942/46 "2018-05-25T09:56:01Z")

</div>

I’ve tried to stay as impartial as I could muster in the recap above. More of my opinion here.

It seems one argument behind amendment is that the length of the proposed rename doesn’t matter, because no one should be typing that, which is a result of the core part of SE-0202: to get _a number_, you should use `Int.random(in: 0 ..< 10)`.

The other argument is that

> [@SE-0202 Amendment: Naming of the standard library random number generator](https://forums.swift.org/t/se-0202-amendment-naming-of-the-standard-library-random-number-generator/12155/1):
>
> `Random` is far too generic and does not allude to the fact that other sources of randomness can (and should) exist. The name `DefaultRandomNumberGenerator` also indicates that it is merely the system default, and developers should consider whether other generators would be more appropriate for their particular case.

...which implies that you would have to come across this type somehow, so that it can promote the full breadth of your options by stunning you with it’s impractical length.

> [@SE-0202 Amendment: Naming of the standard library random number generator](https://forums.swift.org/t/se-0202-amendment-naming-of-the-standard-library-random-number-generator/12155/1):
>
> The main impact this change will have is on how the standard library defines its extensions, and what Swift programmers digging around in autocomplete will see.

**If you use logic, you can not have it both ways!** One of these two arguments is clearly invalid. But there is a good point about the autocomplete. It’s reasonable to expect that Swift users will discover about the SE-0202 additions this way, which is why maintaining `Random` in the current form is so important. In addition to being logical future extension point (for users and stdlib alike), it is superior place to house all the relevant documentation than on the `RandomNumberGenerator` protocol.

I’m assuming that before the release, the 🦇👨—ups, I mean @nnnnnnnn—will come in and fill the `Random` with examples of rolling you own, well distributed an unbiased, PRNG implementations inside the documentation comment, as is the great Swift tradition. 😜

I’m not against the naming discussions per se, but I don’t understand how this amendment made it past the pitch and into the review phase, as I can’t find here any merit beyond bikeshedding. Much more salient naming issue was raised during the amendment pitch:

> [@SE-0202 Amendment: Naming of the standard library random number generator](https://forums.swift.org/t/se-0202-amendment-naming-of-the-standard-library-random-number-generator/12155/15):
>
> On the subject of naming, the proposed term of art in C++ is Uniform Random Bit Generator (URBG): [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0346r1.pdf](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0346r1.pdf) The original terms were uniform random number generator (e.g. Mersenne Twister) and random number distribution (e.g. Uniform, Bernoulli, Poisson): [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3551.pdf](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3551.pdf) The proposed renaming was to make it clear that a generator shouldn't be used as if it were a distribution. Maybe the…

Learning the lesson from C++, our protocol should be named `Random` **`Bit`** `Generator`, to clearly label it as the source of randomness, that is one step removed from the act of generating numbers (done on the numeric types). That should distance the two concepts and address the concern raised earlier:

> [@ben-cohen](#):
>
> If we did find people using it often, this would be a sign we've made it too inviting and that the name `Random.default` could be a cause of this.

To reiterate, I see absolutely no [“immediate need to rename”](https://forums.swift.org/t/se-0202-amendment-proposal-rename-random-to-defaultrandomnumbergenerator/12942/11) `Random` supported with evidence and logical reasoning. Anyone suggesting this should first demonstrate the harm being done. Next they need to demonstrate how mere renaming avoids said harm. In other words: prove that this is not another bikeshedding session, especially in the light of thorough and very productive [pitch phase](https://forums.swift.org/t/proposal-random-unification/6626) on SE-0202, where the design evolved quite a bit and cristalized into well though out final accepted proposal! As a personal heuristic, when the “solution” is type name composed of 4 or more words, I suggest you check yourself for unconscious bias... maybe you haven’t yet fully internalized Swift’s naming guidelines ([“Omit needles words”](https://swift.org/documentation/api-design-guidelines/#promote-clear-usage)) and are just bikeshedding instead of solving a real issue.

---

_[View the full topic](https://forums.swift.org/t/se-0202-amendment-proposal-rename-random-to-defaultrandomnumbergenerator/12942)._
