[gnome-games] gtali: Use better randomization algorithm
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gtali: Use better randomization algorithm
- Date: Thu, 10 Jun 2010 23:13:18 +0000 (UTC)
commit e97c719f3d9fb6cce70481408df221b84d3573a8
Author: Roth Róbert <evfool yahoo com>
Date: Fri Jun 11 09:12:16 2010 +1000
gtali: Use better randomization algorithm
gtali/yahtzee.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtali/yahtzee.c b/gtali/yahtzee.c
index 88c4b84..1f40548 100644
--- a/gtali/yahtzee.c
+++ b/gtali/yahtzee.c
@@ -212,7 +212,8 @@ NewGame (void)
int
RollDie (void)
{
- return ((rand () % 6) + 1);
+ double r = (double) rand() / RAND_MAX;
+ return (int)(r * 6.0) + 1;
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]