{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "76a51710",
   "metadata": {},
   "source": [
    "# 05-18 · randint, randrange, uniform\n",
    "\n",
    "Praktyka do sekcji [„randint, randrange, uniform”](/pl/chapters/rozdzial-05/05-18-randint-randrange-uniform.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab256eaf",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Poznaj różnicę między randint() (obie granice są uwzględnione) a randrange() (górne granice nie są uwzględnione)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "12e508d1",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a2ac54f6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:57.760103Z",
     "iopub.status.busy": "2026-08-16T12:02:57.759965Z",
     "iopub.status.idle": "2026-08-16T12:02:57.777527Z",
     "shell.execute_reply": "2026-08-16T12:02:57.777113Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "print(random.randint(1, 6))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "81364218",
   "metadata": {},
   "source": [
    "## Eksperyment 1\n",
    "\n",
    "randrange(1, 7) jest analogiczny do randint(1, 6), ponieważ górna granica nie jest uwzględniona."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "cbfd5282",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:57.778681Z",
     "iopub.status.busy": "2026-08-16T12:02:57.778576Z",
     "iopub.status.idle": "2026-08-16T12:02:57.780803Z",
     "shell.execute_reply": "2026-08-16T12:02:57.780237Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "print(random.randrange(1, 7))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "08a60258",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Fix `random.seed(1)`, wtedy wyjść `random.randint(1, 10)` – Przy tym seed wynik zawsze jest taki sam (oczekiwane 3), co pozwala automatycznie sprawdzić zadanie."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4d83e255",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T12:02:57.782028Z",
     "iopub.status.busy": "2026-08-16T12:02:57.781900Z",
     "iopub.status.idle": "2026-08-16T12:02:57.784161Z",
     "shell.execute_reply": "2026-08-16T12:02:57.783702Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "random.seed(1)\n",
    "print(random.randint(1, 10))"
   ]
  }
 ],
 "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
}
