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

本站现有博文323篇,共被浏览804201

本站已经建立2504天!

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