Help us understand the problem. What is going on with this article?

乱数と√を組み合わせるとどうなるか?

More than 3 years have passed since last update.

√:ルート

僕はあまり友達ではないですがルートまたの名を平方根というやつです。学生時代に数学で出てきましたね。

乱数と√を組み合わせるとどうなるか?

生成される乱数(0以上1未満)をルートの中に入れると〜

Math.sqrt(Math.random())

こういう結果になります。
sqrt_2.png

乱数で得られる値が大きいときはなめらかに、小さくなると激しくなります。
大きい値の確率が上がり、小さい値の確率が下がる。

「ランダム値ほしいけど、大きい値の確率上げたいな」

というときに使えます。

どちらかというと演出向け?

どちらかとパーティクルを生成するときなどの演出向けかなと思います。
大体は遠くにいてほしいけどたまに近くにグッと来てほしいなどなど。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away