# 隨機的世界真美麗

## 工具：本篇會用到的程式積木有

![](https://1037909400-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLwwLAd_-l8YsFemhSH%2F-LLx8GfUG795yx47U26a%2F-LLx8M8xzv0BWndCpqLb%2Fradom5.PNG?alt=media\&token=34d921e3-dffd-4f0e-8c50-caa677370957)

## 暖身：隨機選取一個三位數並說出來

![三位數的範圍為100-999](https://1037909400-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLwwLAd_-l8YsFemhSH%2F-LLwy_I09QjlAQMOSDVL%2F-LLwzEpznVsHUzUpZlQI%2Fradom1.PNG?alt=media\&token=8cb1ac08-1d73-44c8-867e-817ba48d22d0)

## 練習：隨機選取一個三位數，如果這個三位數是3的倍數，就放進清單中，直到取出10個為止

![](https://1037909400-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLwwLAd_-l8YsFemhSH%2F-LLwzh7Gy8lO1bjQ6thH%2F-LLx-qv9JBRZb_MCz6eg%2Fradom2.PNG?alt=media\&token=78917eb3-0a24-4e1b-a1fa-7d058c56caf6)

1. 先建立一個變數命名為「抽籤」，和建立一個清單
2. 變數「抽籤」設為隨機抽取一個三位數
3. 判斷式：如果被抽出來的數(抽籤)能被3整除，就放進清單中
4. 重複直到清單的項目數有10個為止

{% hint style="info" %}
初始化設定：點綠旗後先清空清單項目，才能每次點綠旗都抽10個
{% endhint %}

## 暖身：隨機抽取10個十以內的數，放進清單中

![只是重複選數10次，放進清單中的數可能會有重複](https://1037909400-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLwwLAd_-l8YsFemhSH%2F-LLx-uHj1-qQXtdPsubz%2F-LLx3cH8OAkGIrjh7xnH%2Fradom4.PNG?alt=media\&token=4b5374eb-4343-473f-9d3f-84b68096f151)

## 本篇任務：隨機選取10個十以內的數放進清單，但不能重複

![](https://1037909400-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLwwLAd_-l8YsFemhSH%2F-LLx-uHj1-qQXtdPsubz%2F-LLx4GENYB6DX76nD7oL%2Fradom3.PNG?alt=media\&token=0f2b5e1a-879f-4bfa-9014-a06baa31b375)

1. 先建立一個變數命名為「中獎」，和建立一個清單
2. 變數「中獎」設定為隨機抽取1-10之間的數
3. 判斷式：抽出來的數如果已經出現在清單過，就什麼也不做，如果沒有出現過就新增的清單中
4. 重複執行到清單的項目數有10個為止

{% hint style="info" %}
判斷式中也可以加入如果已經出現過就說「這個數出現過了重抽」，如果沒有說「沒出現過哦，加入清單」之後才加進清單試試!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cyc-channel.gitbook.io/scratch/de-shi-jie-zhen-mei.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
