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

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

本站已经建立2583天!

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