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

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

本站已经建立2602天!

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