Last change
on this file was
80,
checked in by Sam Hocevar, 11 years ago

 Adding the Golgotha source code. Not sure what's going to be interesting
in there, but since it's all public domain, there's certainly stuff to
pick up.


Property svn:executable set to
*

Property svn:keywords set to
Id

File size:
719 bytes

Line  

1  #!/usr/bin/perl


2 


3  $n = 500;


4 


5  for ($i=0; $i<$n; $i++)


6  {


7  $x[$i] = rand(10)  5.0;


8  $y[$i] = rand(10)  5.0;


9  }


10 


11  for ($i=0; $i<$n; $i++)


12  {


13  for ($j=$i+1; $j<$n; $j++)


14  {


15  $a = $x[$i]*$x[$i] + $y[$i]*$y[$i];


16  $b = $x[$j]*$x[$j] + $y[$j]*$y[$j];


17  if ($a>$b)


18  {


19  $t = $x[$i];


20  $x[$i] = $x[$j];


21  $x[$j] = $t;


22 


23  $t = $y[$i];


24  $y[$i] = $y[$j];


25  $y[$j] = $t;


26  }


27  }


28  }


29 


30  print


31  "static i4_float distrib[][3] =\n" .


32  "{\n";


33  for ($i=0; $i<50; $i++)


34  {


35  $a = $x[$i]*$x[$i] + $y[$i]*$y[$i];


36  printf(" { %10.7f, %10.7f, %10.7f },\n", $x[$i] , $y[$i], $a);


37  }


38  print "};\n";


Note: See
TracBrowser
for help on using the repository browser.