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

本站现有博文327篇,共被浏览833715

本站已经建立2538天!

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