Jump to content

Rand()


GoodVibe

Recommended Posts

Hello everybody,

 

I just have a quick question.

 

I am trying to develop a webpage for dice rolling (to use for myself when i play dnd)

 

Now, I know a lot of the random functions is computer languages are not truly random, and thus have some areas that the value will be the result more than others.

 

What would be a good way to try to make it as "random" as possible, or am I just over-thinking it?

Link to comment
https://forums.phpfreaks.com/topic/261485-rand/
Share on other sites

The only issue with rand() or mt_rand() is that they're not cryptographically secure. Their results tables are generated by a seed, usually involving the date/time in microseconds.

 

For a dice roller, it'll work extremely well. The distribution is as good as you'd need.

 

In any pseudo-random environment, results won't be perfectly even. What you want is over many, many iterations, these numbers are distributed well and no patterns show up for any specific results.

Link to comment
https://forums.phpfreaks.com/topic/261485-rand/#findComment-1339991
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.