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

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

本站已经建立2673天!

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