EADST

C++: Get A Normal Distribution Random Number

C++: Get A Normal Distribution Random Number

#include  < random>

using namespace std;

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

本站现有博文339篇,共被浏览998357次

本站已经建立2709天!

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