home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / DBWBOUND.ZIP / RND.C < prev    next >
C/C++ Source or Header  |  1989-04-17  |  9KB  |  147 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                  Copyright (c) 1987, David B. Wecker                 *
  4.  *                          All Rights Reserved                         *
  5.  *                                                                      *
  6.  * This file is part of DBW_Render                                      *
  7.  *                                                                      *
  8.  * DBW_Render is distributed in the hope that it will be useful, but    *
  9.  * WITHOUT ANY WARRANTY. No author or distributor accepts               *
  10.  * responsibility to anyone for the consequences of using it or for     *
  11.  * whether it serves any particular purpose or works at all, unless     *
  12.  * he says so in writing. Refer to the DBW_Render General Public        *
  13.  * License for full details.                                            *
  14.  *                                                                      *
  15.  * Everyone is granted permission to copy, modify and redistribute      *
  16.  * DBW_Render, but only under the conditions described in the           *
  17.  * DBW_Render General Public License. A copy of this license is         *
  18.  * supposed to have been given to you along with DBW_Render so you      *
  19.  * can know your rights and responsibilities. It should be in a file    *
  20.  * named COPYING. Among other things, the copyright notice and this     *
  21.  * notice must be preserved on all copies.                              *
  22.  ************************************************************************
  23.  *                                                                      *
  24.  * Authors:                                                             *
  25.  *      DBW - David B. Wecker                                           *
  26.  *                                                                      *
  27.  * Versions:                                                            *
  28.  *      V1.0 870125 DBW - First released version                        *
  29.  *                                                                      *
  30.  ************************************************************************/
  31.  
  32. #define MODULE_RND
  33. #include "ray.h"
  34.  
  35. int         Rnd_index = 0;
  36. float       Rnd_table[] = 
  37. {
  38.      0.66039455, 0.55883259, 0.43100151, 0.45234853, 0.33356366,
  39.      0.96729124, 0.03497256, 0.49987379, 0.81571507, 0.48484063,
  40.      0.23955500, 0.42106923, 0.00333404, 0.84910566, 0.52160072,
  41.      0.46888468, 0.57266688, 0.47052220, 0.73102516, 0.30397582,
  42.      0.92630136, 0.39845976, 0.02226945, 0.96624905, 0.73988312,
  43.      0.15228045, 0.31437615, 0.12302544, 0.63890541, 0.73269665,
  44.      0.07859282, 0.79678410, 0.71267051, 0.06444315, 0.99632233,
  45.      0.23828882, 0.88228440, 0.86243427, 0.62029976, 0.94630319,
  46.      0.31340083, 0.27554846, 0.41767040, 0.86793905, 0.68609148,
  47.      0.94503951, 0.23717174, 0.38039058, 0.52767789, 0.43480283,
  48.      0.18045221, 0.51707941, 0.54880023, 0.29194686, 0.27177402,
  49.      0.39760667, 0.61195314, 0.30295882, 0.53455746, 0.48368040,
  50.      0.14330430, 0.29381171, 0.29778969, 0.39432430, 0.14147970,
  51.      0.97545040, 0.96050745, 0.80395979, 0.64148021, 0.34066963,
  52.      0.87834126, 0.37106207, 0.46337044, 0.92205679, 0.29857180,
  53.      0.42302483, 0.90372425, 0.56816280, 0.21580912, 0.93421835,
  54.      0.25233483, 0.39560109, 0.65521789, 0.75776988, 0.05979671,
  55.      0.34684730, 0.48672396, 0.63939446, 0.88286626, 0.66466457,
  56.      0.49179363, 0.22861485, 0.57803345, 0.44241402, 0.87310123,
  57.      0.74813133, 0.82594711, 0.95874459, 0.53631592, 0.52428281,
  58.      0.07453864, 0.29997587, 0.56598550, 0.37530747, 0.86875927,
  59.      0.82123774, 0.14674027, 0.98345047, 0.79844952, 0.49079132,
  60.      0.11138768, 0.20646314, 0.08159930, 0.22118436, 0.31100619,
  61.      0.74553245, 0.47500372, 0.89299130, 0.30907968, 0.46496227,
  62.      0.92681891, 0.81086975, 0.92389625, 0.90267634, 0.40609396,
  63.      0.12491301, 0.46055952, 0.71717691, 0.48701805, 0.39691967,
  64.      0.61645335, 0.01346534, 0.32462496, 0.72957969, 0.24959332,
  65.      0.76446760, 0.44815296, 0.70655185, 0.58471507, 0.19080324,
  66.      0.32975167, 0.63750023, 0.30073157, 0.75882113, 0.44370833,
  67.      0.38967538, 0.79636955, 0.83903283, 0.79126149, 0.03543016,
  68.      0.57328200, 0.38335198, 0.97315502, 0.53252780, 0.94358242,
  69.      0.19376294, 0.03870409, 0.61536962, 0.65190881, 0.45953876,
  70.      0.95154250, 0.52719963, 0.20925008, 0.81023216, 0.87024897,
  71.      0.00442881, 0.86083883, 0.75410801, 0.84559667, 0.39172313,
  72.      0.31176978, 0.45793274, 0.27375799, 0.17481472, 0.91679400,
  73.      0.29109645, 0.85057425, 0.90755624, 0.88485098, 0.61700886,
  74.      0.16986775, 0.16714142, 0.41063660, 0.92036927, 0.82394582,
  75.      0.35207534, 0.08432868, 0.76780045, 0.01633263, 0.85133868,
  76.      0.30040643, 0.09705002, 0.29660097, 0.27920771, 0.04914036,
  77.      0.63974702, 0.09425075, 0.51218516, 0.95719063, 0.99174523,
  78.      0.55256492, 0.04624967, 0.70185024, 0.65444416, 0.47018296,
  79.      0.33752775, 0.86390626, 0.28934693, 0.71361750, 0.65103120,
  80.      0.63721287, 0.10066172, 0.06525321, 0.45557779, 0.78825164,
  81.      0.04289675, 0.71871716, 0.60762459, 0.85765970, 0.78117764,
  82.      0.05442521, 0.32869899, 0.50881964, 0.51319140, 0.57610494,
  83.      0.59424084, 0.07732942, 0.47847587, 0.79267257, 0.42645878,
  84.      0.42163047, 0.54678464, 0.42651218, 0.35960680, 0.10316559,
  85.      0.77248901, 0.26691166, 0.42299846, 0.18294813, 0.43447700,
  86.      0.34268448, 0.53300786, 0.89463943, 0.23163281, 0.68699974,
  87.      0.96470684, 0.18113181, 0.08748525, 0.89558238, 0.95637912,
  88.      0.12794316, 0.43072519, 0.26200274, 0.36265647, 0.77765608,
  89.      0.28752553, 0.00785084, 0.04778178, 0.97281432, 0.60456401,
  90.      0.47732633, 0.32382685, 0.64605945, 0.40069914, 0.83821362,
  91.      0.03672313, 0.29624382, 0.91242194, 0.73334467, 0.14441800,
  92.      0.79346949, 0.95764869, 0.38418418, 0.89787120, 0.96757883,
  93.      0.16917229, 0.57402438, 0.44447729, 0.06600766, 0.90715456,
  94.      0.59621108, 0.66702515, 0.16608889, 0.70924902, 0.92416501,
  95.      0.22501864, 0.65470600, 0.13614295, 0.07091190, 0.89060146,
  96.      0.71340835, 0.21636823, 0.81360400, 0.45341012, 0.48810509,
  97.      0.21317105, 0.80270755, 0.74008924, 0.75996047, 0.13725966,
  98.      0.97931659, 0.35027769, 0.93226653, 0.92952371, 0.49592277,
  99.      0.65788972, 0.91351080, 0.98969388, 0.59358692, 0.24879846,
  100.      0.54255962, 0.61121863, 0.78308553, 0.73235965, 0.82468259,
  101.      0.01105663, 0.74137026, 0.57581574, 0.04209147, 0.78911960,
  102.      0.41594574, 0.07191648, 0.83355105, 0.61910200, 0.02146804,
  103.      0.43946904, 0.71043992, 0.02955279, 0.86443663, 0.05634884,
  104.      0.69963002, 0.38548401, 0.51081753, 0.80917525, 0.69165558,
  105.      0.28505373, 0.27234674, 0.86453342, 0.58394921, 0.66549689,
  106.      0.20315948, 0.21995576, 0.76201797, 0.05067815, 0.04081947,
  107.      0.42844948, 0.75335014, 0.92176402, 0.09552186, 0.31818563,
  108.      0.88165480, 0.50115812, 0.85641491, 0.22773147, 0.51775622,
  109.      0.78659642, 0.99149436, 0.10724692, 0.52657431, 0.93181688,
  110.      0.21503040, 0.63843507, 0.98407501, 0.82759136, 0.85364097,
  111.      0.89342541, 0.74504662, 0.69568896, 0.15554366, 0.96248204,
  112.      0.15805312, 0.39962929, 0.56129420, 0.17854372, 0.72134209,
  113.      0.88300914, 0.86179477, 0.92323065, 0.07573128, 0.84142655,
  114.      0.37894547, 0.35396722, 0.13663971, 0.29512617, 0.17043614,
  115.      0.39358595, 0.11535909, 0.18444648, 0.03019012, 0.01705277,
  116.      0.13412201, 0.57749164, 0.82965249, 0.87416852, 0.25652128,
  117.      0.73696095, 0.56047028, 0.06962129, 0.76323164, 0.47231114,
  118.      0.72400832, 0.25079474, 0.82510477, 0.55953693, 0.22979946,
  119.      0.72552741, 0.06671461, 0.64770812, 0.76123393, 0.21249078,
  120.      0.68117207, 0.67571294, 0.23768504, 0.60360384, 0.00362229,
  121.      0.19718978, 0.20120803, 0.36192089, 0.75586528, 0.12983640,
  122.      0.98948932, 0.86639827, 0.06030697, 0.21787915, 0.37215963,
  123.      0.84620929, 0.46646529, 0.23639441, 0.11920957, 0.33247119,
  124.      0.67693210, 0.94868892, 0.79590058, 0.16765361, 0.98149949,
  125.      0.79151261, 0.75611699, 0.53983968, 0.84278053, 0.64091754,
  126.      0.47334084, 0.15256503, 0.81164110, 0.60239601, 0.61384827,
  127.      0.10351815, 0.34741706, 0.77694947, 0.21295035, 0.50168651,
  128.      0.68382788, 0.84378248, 0.97606289, 0.23659377, 0.01435784,
  129.      0.23100978, 0.03764819, 0.49125907, 0.48236716, 0.31049761,
  130.      0.85269231, 0.88431096, 0.21705988, 0.45891744, 0.45275435,
  131.      0.55167323, 0.55118114, 0.26995870, 0.49861628, 0.99518359,
  132.      0.75912309, 0.95044589, 0.40393665, 0.99943906, 0.73741013,
  133.      0.00996813, 0.02172562, 0.79515576, 0.94572723, 0.76978689,
  134.      0.19193551, 0.29213494, 0.07386845, 0.66185164, 0.90342182,
  135.      0.13842428, 0.33573803, 0.38495737, 0.95907974, 0.57919484,
  136.      0.10692066, 0.60342520, 0.20533419, 0.11157908, 0.44710901,
  137.      0.72701418, 0.85873157, 0.48064619, 0.92745274, 0.00165919
  138. }
  139. ;
  140.  
  141. float rnd() 
  142. {
  143.      Rnd_index = ++Rnd_index % 500;
  144.      return(Rnd_table[Rnd_index]);
  145. }
  146.  
  147.