EADST

Python: Get A List of Different Random Numbers

Only one line can get a list of different random numbers (sampling without replacement). Here is the code.

import random

print(random.sample(range(1, 10), 5))
# output: [5, 8, 4, 1, 7]
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
API Bipartite MD5 HuggingFace UNIX Nginx Excel git-lfs 阿里云 CSV Miniforge ms-swift mmap Color Windows 云服务器 Video Zip 财报 Datetime Tiktoken Qwen 第一性原理 TensorRT Template 腾讯云 Food YOLO Mixtral Land HaggingFace Translation Agent Review Linux VGG-16 CV LLM Rebuttal News NLTK LeetCode OpenCV Firewall Vmess 搞笑 递归学习法 GoogLeNet Pytorch Clash Pickle SVR SPIE RAR Disk Qwen2.5 签证 PyCharm PDF RL BF16 Plotly torchinfo 图形思考法 Attention BeautifulSoup FastAPI PyTorch diffusers DeepSeek CEIR ONNX Ubuntu v0.dev DeepStream Tracking Knowledge 强化学习 scipy Plate BTC tar Input Logo FP8 Michelin Base64 Bert Paddle C++ EXCEL Gemma 证件照 Bitcoin VSCode PDB git VPN icon SQLite Heatmap FP64 Search InvalidArgumentError Web Conda 论文 Paper PIP ResNet-50 SQL GGML TTS LLAMA Ptyhon Algorithm NameSilo Jupyter 公式 CUDA GIT Animate printf 论文速读 版权 Interview Numpy 净利润 Diagram 域名 uwsgi Jetson tqdm Tensor XGBoost CAM GPT4 Augmentation Markdown Sklearn JSON Freesound Llama Permission OpenAI Hilton CC Random Domain ChatGPT Magnet Proxy Baidu WebCrawler llama.cpp logger UI 飞书 Transformers Anaconda Pillow Github LoRA 多线程 Statistics 音频 Streamlit OCR Vim TSV Google ModelScope Hungarian TensorFlow XML WAN GPTQ Cloudreve NLP Qwen2 Use RGB Safetensors COCO Docker 多进程 API网关 hf Claude 关于博主 报税 Breakpoint Card FlashAttention FP16 继承 Pandas Hotel Quantize Image2Text Data Quantization Bin QWEN Website Shortcut CLAP 算法题 Distillation Python Dataset Math FP32 顶会 Password CTC AI uWSGI v2ray transformers SAM 图标 IndexTTS2 Harness Django Crawler Git LaTeX
站点统计

本站现有博文336篇,共被浏览947733

本站已经建立2658天!

热门文章
文章归档
回到顶部