Skip to content

Commit 9f7cb14

Browse files
committed
use Bool.random()
1 parent 27c93ac commit 9f7cb14

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

TouchLemmings/LemmingsScene.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class LemmmingsScene: SKScene, SKPhysicsContactDelegate {
3838
func addLemming(at: CGPoint) {
3939
let l = Lemming()
4040
scene?.addChild(l)
41-
l.position = at
42-
l.state = .walking(direction: .left)
43-
44-
let shouldFall = arc4random_uniform(2) != 0
45-
if shouldFall {
41+
42+
if Bool.random() {
4643
l.position = CGPoint(x: at.x, y: 40)
4744
l.state = .falling
45+
} else {
46+
l.position = at
47+
l.state = .walking(direction: .left)
4848
}
4949

5050
lemmings.append(l)

0 commit comments

Comments
 (0)