3
2

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 3 years have passed since last update.

Swift:乱数の備忘録

Last updated at Posted at 2020-05-10

##バージョン

・Xcode11.4.1
・Swift5

##概要
ランダムな数字を出力する

##コード

test.swift
//ランダム関数で0〜4のうちひとつを出力する
let imageNumber = Int.random(in: 0...4)
print(imageNumber)
//出力結果
//0or1or2or3or4のどれかひとつ

##参考にさせて頂いた記事
【Swift】乱数を生成する方法

3
2
0

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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?