20
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

js 特定範囲内のランダムな整数の求め方

Last updated at Posted at 2015-09-18

Math.random()*(最大値-最小値)+最小値

でいけました!

hoge
// 15〜25までの乱数を吐き出す
var randNum = Math.floor(Math.random()*(25-15)+15);
20
9
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?