> For the complete documentation index, see [llms.txt](https://docs.codpeller.com/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codpeller.com/en/social-proof/product-guide/vsplyvayushee-soobshenie/nedavno-kuplennyi-tovar/randomno.md). Agents can also search and read this documentation through its [MCP server](https://docs.codpeller.com/en/~gitbook/mcp).

# Рандомно

В сообщении, по очереди, отображаются первые 100 товаров из каталога магазина, которые отдает платформа, порядок не регламентирован, поэтому мы не знаем какие товары попали в эти 100 штук. Для появления во всплывающем сообщении товар должен быть в наличии и доступен для продажи.

### **Алгоритм работы.**

Так как приложение должно работать как на реальных данных, то алгоритм появления сообщения, следующий:

Берем первые 100 товаров, и назначаем каждому товару свое время показа из интервала в настройках (Рис.30а) и случайные данные о покупке.

Далее выжидаем время начала показа, и запускаем бесконечный цикл:

берем из выборки случайных товаров случайный товар и показываем его, ждем интервал который ему выпал и показываем следующий и т.д.

#### **Пример:**

В настройках сообщения задали:

* начало показа: через 5 секунд
* интервал между показами: от 5 до 60 секунд
* длительность показа: 15 секунд

Покупатель зашел на страницу категорий, читает список категорий:

* через 5 секунд как он зашел, у него появится 1-ое сообщение с первым товаром (случайный товар из первых 100 товаров) и будет видно 15 секунд, после скрытия сообщения,
* через 9 секунд (случайное число) появляется 2-е сообщение со вторым товаром (случайный товар из первых 100 товаров), его видно 15 секунд, после его закрытия сообщения,
* через 40 секунд (случайное число) появляется 3-е сообщение с третьим товаром (случайный товар из первых 100 товаров), его видно 15 секунд, после оно закрывается
* и т.д. до бесконечности.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.codpeller.com/en/social-proof/product-guide/vsplyvayushee-soobshenie/nedavno-kuplennyi-tovar/randomno.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
