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

本站现有博文332篇,共被浏览873899

本站已经建立2582天!

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