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

本站现有博文323篇,共被浏览796026

本站已经建立2493天!

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