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

本站现有博文338篇,共被浏览984103次

本站已经建立2697天!

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