# Randomised events

**URL:** https://forum.makecode.com/t/randomised-events/4516
**Category:** Help
**Created:** [November 20, 2020, 3:32am UTC](https://forum.makecode.com/t/randomised-events/4516 "2020-11-20T03:32:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![femurbreaker](https://avatars.discourse-cdn.com/v4/letter/f/b77776/32.png) [@femurbreaker](https://forum.makecode.com/u/femurbreaker)
#### Post date: [November 20, 2020, 3:32am UTC](https://forum.makecode.com/t/randomised-events/4516/1 "2020-11-20T03:32:48Z")

</div>

Im currently making a game where i need to have randomised events, such as spawning enemies and weapons.

Please help

---

<div class="post-metadata">

### Author: ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)
#### Post date: [November 20, 2020, 4:07am UTC](https://forum.makecode.com/t/randomised-events/4516/2 "2020-11-20T04:07:04Z")

</div>

I think the team made a live stream that you can find on youtube about it! This is if you’re talking about waves of enemies

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [November 20, 2020, 1:01pm UTC](https://forum.makecode.com/t/randomised-events/4516/3 "2020-11-20T13:01:14Z")

</div>

Welcome to the forums!

There are two main blocks used for randomizing events:

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/8a314eae62339f11b72763e123707c1bfd9ea6a9.png)

The first one returns a `boolean` while the second one returns a `number`.

A common use case is this:

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/6/6fa8e3fef252358270bb664797346fbcbe91a505.png)

Every second, there is a 50% chance to call `spawn_enemy`.

Another really common use case is this:

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/fc1ec7342b8024f4ebc48eb73123d224e38732aa.png)

There is a 60% chance to call `spawn_enemy`. There is a 30% chance to call `spawn_bad_enemy`. There is a 10% chance to call `spawn_really_bad_enemy`.

Hopefully this helps.

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [November 20, 2020, 1:02pm UTC](https://forum.makecode.com/t/randomised-events/4516/4 "2020-11-20T13:02:36Z")

</div>

There is also tutorials that use the random blocks I mentioned above. Such include:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/b/b7bc73ba4ac0187fc32a76565ccf88ba0bc84c4d.png)  
which I know uses that block.
