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

本站现有博文337篇,共被浏览962162次

本站已经建立2674天!

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