# Chapter 3 challenge, just for fun a little randomness

**URL:** <https://forums.kodeco.com/t/chapter-3-challenge-just-for-fun-a-little-randomness/55051>\
**Category:** iOS Animations by Tutorials\
**Created:** [November 9, 2018, 6:18pm UTC](https://forums.kodeco.com/t/chapter-3-challenge-just-for-fun-a-little-randomness/55051 "2018-11-09T18:18:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![armandzwan](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/armandzwan/32/106800_2.png) [@armandzwan](https://forums.kodeco.com/u/armandzwan)\
**Post date:** [November 9, 2018, 6:18pm UTC](https://forums.kodeco.com/t/chapter-3-challenge-just-for-fun-a-little-randomness/55051/1 "2018-11-09T18:18:16Z")

</div>

Add this line of code after line 187 in ViewController.swift and the clouds will start their animation at a different y position.  
`cloud.frame.origin.y = CGFloat.random(in: 100..<self.view.frame.size.height-200)`

You could do the same with the speed to create the illusion of depth. Replace line 182 with:  
`let cloudSpeed = CGFloat.random(in: 30.0..<120.0) / view.frame.size.width`

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [December 12, 2018, 12:43am UTC](https://forums.kodeco.com/t/chapter-3-challenge-just-for-fun-a-little-randomness/55051/2 "2018-12-12T00:43:30Z")

</div>

@armandzwan Thank you for sharing this - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [April 25, 2019, 10:18am UTC](https://forums.kodeco.com/t/chapter-3-challenge-just-for-fun-a-little-randomness/55051/3 "2019-04-25T10:18:17Z")

</div>

Closed on April 25, 2019, 10:18am UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
