# Math.random in kotlin

**URL:** <https://discuss.kotlinlang.org/t/math-random-in-kotlin/6011>\
**Category:** Libraries\
**Created:** [December 29, 2017, 1:20pm UTC](https://discuss.kotlinlang.org/t/math-random-in-kotlin/6011 "2017-12-29T13:20:30Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![alanfo](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@alanfo](https://discuss.kotlinlang.org/u/alanfo)\
**Post date:** [December 29, 2017, 3:34pm UTC](https://discuss.kotlinlang.org/t/math-random-in-kotlin/6011/12 "2017-12-29T15:34:52Z")

</div>

Just off the top of my head, you could include a parameter in the Random class constructor which would default to the platform-specific generator but could be set to a platform-independent algorithm or perhaps a choice of such algorithms.

These algorithms would still produce a different sequence of ‘random’ numbers on each run unless you set the seed (another optional constructor parameter and/or a separate property) to some constant value.

---

_[View the full topic](https://discuss.kotlinlang.org/t/math-random-in-kotlin/6011)._
