随机整数 [英] randomizing integers

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

问题描述

不确定这是否可行,但是有没有办法将一套从0到n(更具体地说是0到100)的整数集合随机化

而不用

使用rand()和标准C?

Not sure if this is possible, but is there some way to randomize a set
of integers from 0 to n(more specifically 0 to 100 inclusive) without
using rand() and in standard C?

推荐答案



" Mantorok Redgormor" <是ne ***** @ tokyo.com>在消息中写道

news:41 ************************** @ posting.google.c om ...

"Mantorok Redgormor" <ne*****@tokyo.com> wrote in message
news:41**************************@posting.google.c om...
不确定这是否可行,但是有没有办法将一组整数从0到n(更具体地说是0到100,包括在内)随机化,而不使用rand( )和标准C?
Not sure if this is possible, but is there some way to randomize a set
of integers from 0 to n(more specifically 0 to 100 inclusive) without
using rand() and in standard C?




如果您使用标准C编写自己的随机数生成器函数

,那么肯定。 br />

为什么你不能用''兰德()''?


-Mike



If you write your own random number generator function
using only standard C, then yes, sure.

Why can''t you use ''rand()''?

-Mike


Mantorok Redgormor写道:
Mantorok Redgormor wrote:

不确定这是否可行,但有没有办法将一组整数从0到n随机化(更具体地说0到100(包括))没有
使用rand()和标准C?

Not sure if this is possible, but is there some way to randomize a set
of integers from 0 to n(more specifically 0 to 100 inclusive) without
using rand() and in standard C?




我不知道为什么限制,但在网上搜索PRN发电机

in C.Mersenne Twister可能适合您的账单。



Brian Rodenborn



I''m not sure why the restriction, but search the web for PRN generators
in C. The Mersenne Twister may fit the bill for you.


Brian Rodenborn


" Mike Wahler" < MK ****** @ mkwahler.net>写道:
"Mike Wahler" <mk******@mkwahler.net> writes:
" Mantorok Redgormor" <是ne ***** @ tokyo.com>在消息中写道
新闻:41 ************************** @ posting.google.c om ...
"Mantorok Redgormor" <ne*****@tokyo.com> wrote in message
news:41**************************@posting.google.c om...
不确定这是否可行,但有没有办法将一组整数从0到n(更具体地说是0到100,包括在内)随机化,而不使用rand()和标准C?
Not sure if this is possible, but is there some way to randomize a set
of integers from 0 to n(more specifically 0 to 100 inclusive) without
using rand() and in standard C?



如果您使用标准C编写自己的随机数生成器功能,那么是的,确定。

为什么不能你使用''rand()''?



If you write your own random number generator function
using only standard C, then yes, sure.

Why can''t you use ''rand()''?




可能因为rand()的实现往往很差。


-

Keith Thompson(The_Other_Keith) ks*@cts.com < http://www.ghoti。 net / ~kst>

圣地亚哥超级计算机中心< *> < http://www.sdsc.edu/~kst>

Schroedinger做莎士比亚:要*和*不要



Possibly because implementations of rand() tend to be poor.

--
Keith Thompson (The_Other_Keith) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"


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

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