大大吉が出る確率を2倍少なくしたいです。
Swift
1import UIKit 2 3class ViewController: UIViewController { 4 5 @IBOutlet weak var label: UILabel! 6 @IBAction func buttan(_ sender: Any) { 7 let num = arc4random_uniform(15) 8 var result = "結果" 9 switch num { 10 11 case 0: 12 result = "????大大吉????" 13 case 1: 14 result = "????大吉????" 15 case 2: 16 result = "中吉" 17 case 3: 18 result = "小吉" 19 case 4: 20 result = "吉" 21 22 23 default: 24 break 25 } 26 label.text = result 27 } 28 override func viewDidLoad() { 29 super.viewDidLoad() 30 // Do any additional setup after loading the view, typically from a nib. 31 } 32 33 override func didReceiveMemoryWarning() { 34 super.didReceiveMemoryWarning() 35 // Dispose of any resources that can be recreated. 36 } 37 38 39} 40
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/19 05:22