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

本站现有博文324篇,共被浏览821416

本站已经建立2526天!

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