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

本站现有博文320篇,共被浏览759653

本站已经建立2428天!

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