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

本站现有博文319篇,共被浏览751857

本站已经建立2408天!

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