{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "60b783ed",
   "metadata": {},
   "source": [
    "# 05-20 · seed и воспроизводимость\n",
    "\n",
    "Практика к разделу [«seed и воспроизводимость»](../../site/chapters/glava-05/05-20-seed.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bea4ca85",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Убедиться, что одинаковый seed даёт одинаковую последовательность случайных чисел."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "00b0e536",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8aea1b50",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:59.427401Z",
     "iopub.status.busy": "2026-08-16T12:02:59.427262Z",
     "iopub.status.idle": "2026-08-16T12:02:59.449974Z",
     "shell.execute_reply": "2026-08-16T12:02:59.449342Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "82\n",
      "82\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "random.seed(42)\n",
    "print(random.randint(1, 100))\n",
    "random.seed(42)\n",
    "print(random.randint(1, 100))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a72959f",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Зафиксируйте `random.seed(5)`, затем выведите `random.randint(1, 100)` (ожидается 80 — тот же результат каждый раз при этом seed)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4c529533",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:59.451249Z",
     "iopub.status.busy": "2026-08-16T12:02:59.451107Z",
     "iopub.status.idle": "2026-08-16T12:02:59.453685Z",
     "shell.execute_reply": "2026-08-16T12:02:59.453136Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "80\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "random.seed(5)\n",
    "print(random.randint(1, 100))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
