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

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

本站已经建立2469天!

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