随机整数与g ++ 4.4.5 [英] Random integers with g++ 4.4.5

查看:154
本文介绍了随机整数与g ++ 4.4.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一些间隔中生成随机整数。我不想使用srand的基本实现srand与时间(NULL)作为种子,因为我已经阅读,它不是最随机的方式这样做。

I'd like to generate random integers in some interval. I don't want to use the basic implementation of srand with time(NULL) as the seed since I have read that it is not the most "random" way of doing this.

我已经看到很多的帖子描述如何使用std :: uniform_int_distribution在C + + 11,但不幸的是,我的计算集群仍然坚持使用g ++ 4.4.5,没有这个能力。这个编译器有什么类似的东西吗?

I have seen lots of posts describing how to use std::uniform_int_distribution in C++11, but unfortunately, I work on a computing cluster that is still stuck with g++ 4.4.5, which doesn't have this capability. Is there anything similar available for this compiler?

推荐答案

我假设你需要这些随机数的统计不加密。只需使用 Merssenne Twister

I assume you need those random numbers for statistics not crypto. Just use the Merssenne Twister

这篇关于随机整数与g ++ 4.4.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆