{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import random" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[0.5518201298350598, 0.3476911314933616, 0.8463426180468342, 0.8949046353303931, 0.40822657702632625]\n" ] } ], "source": [ "print([random.random() for i in range(5)])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[8, 5, 7, 10, 7]\n" ] } ], "source": [ "print([random.randint(0, 10) for i in range(5)])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[6, 4, 3, 7, 5]\n" ] } ], "source": [ "print(random.sample(range(10), k=5))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[130, 190, 140, 150, 170]\n" ] } ], "source": [ "print(random.sample(range(100, 200, 10), k=5))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "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.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }