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

本站现有博文336篇,共被浏览939462

本站已经建立2650天!

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