[xiph-commits] r10067 - trunk/planarity
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Sun Sep 25 20:44:53 PDT 2005
Author: xiphmont
Date: 2005-09-25 20:44:51 -0700 (Sun, 25 Sep 2005)
New Revision: 10067
Modified:
trunk/planarity/graph.c
trunk/planarity/graph_generate_mesh1.c
trunk/planarity/version.h
Log:
New random number generator now in use.
Modified: trunk/planarity/graph.c
===================================================================
--- trunk/planarity/graph.c 2005-09-26 03:32:50 UTC (rev 10066)
+++ trunk/planarity/graph.c 2005-09-26 03:44:51 UTC (rev 10067)
@@ -31,6 +31,7 @@
#include <math.h>
#include "graph.h"
+#include "random.h"
#include "timer.h"
#include "gameboard.h"
#define CHUNK 64
@@ -585,7 +586,7 @@
w=0;
while(a && b){
- if(random()&1){
+ if(random_yes(64)&1){
// pull off head of a
if(w)
w=w->next=a;
Modified: trunk/planarity/graph_generate_mesh1.c
===================================================================
--- trunk/planarity/graph_generate_mesh1.c 2005-09-26 03:32:50 UTC (rev 10066)
+++ trunk/planarity/graph_generate_mesh1.c 2005-09-26 03:44:51 UTC (rev 10067)
@@ -28,6 +28,7 @@
#include <string.h>
#include "graph.h"
+#include "random.h"
#include "gameboard.h"
#include "graph_generate.h"
#include "graph_arrange.h"
@@ -153,7 +154,7 @@
nl->num=count;
}
-static void random_populate(graph *g, int current, mesh *m, int min_connect, float prob){
+static void random_populate(graph *g, int current, mesh *m, int min_connect, int prob_128){
int num_edges=0,i;
neighbors_grid ng;
neighbors_list nl;
@@ -170,7 +171,7 @@
}
while(num_edges<min_connect && nl.num){
- int choice = random() % nl.num;
+ int choice = random_number() % nl.num;
add_edge(g,m->v[current], m->v[nl.vnum[choice]]);
num_edges++;
filter_intersections(&ng);
@@ -178,7 +179,7 @@
}
for(i=0;i<nl.num;i++)
- if(random()<RAND_MAX*prob){
+ if(random_yes(prob_128)){
num_edges++;
add_edge(g,m->v[current], m->v[nl.vnum[i]]);
}
@@ -196,7 +197,7 @@
if(nl.num == 0) break;
{
- int choice = random() % nl.num;
+ int choice = random_number() % nl.num;
add_edge(g,m->v[current], m->v[nl.vnum[choice]]);
span_depth_first(g,nl.vnum[choice], m);
@@ -211,7 +212,7 @@
m.height=2;
vertex *vlist;
- srandom(order);
+ random_seed(order);
{
while(--order){
if(flag){
@@ -244,7 +245,7 @@
{
int i;
for(i=0;i<m.width*m.height;i++)
- random_populate(g, i, &m, 2, .25);
+ random_populate(g, i, &m, 2, 32);
}
randomize_verticies(g);
Modified: trunk/planarity/version.h
===================================================================
--- trunk/planarity/version.h 2005-09-26 03:32:50 UTC (rev 10066)
+++ trunk/planarity/version.h 2005-09-26 03:44:51 UTC (rev 10067)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Sun Sep 25 23:29:01 EDT 2005] */
+/* DO NOT EDIT: Automated versioning hack [Sun Sep 25 23:43:59 EDT 2005] */
More information about the commits
mailing list