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

本站现有博文321篇,共被浏览768087

本站已经建立2452天!

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