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

本站现有博文333篇,共被浏览922691

本站已经建立2628天!

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