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

本站现有博文333篇,共被浏览915356

本站已经建立2619天!

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