About: Source:NetHack 2.2a/rnd.c   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Below is the full text to rnd.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/rnd.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code

AttributesValues
rdfs:label
  • Source:NetHack 2.2a/rnd.c
rdfs:comment
  • Below is the full text to rnd.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/rnd.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code
dcterms:subject
dbkwik:nethack/pro...iPageUsesTemplate
abstract
  • Below is the full text to rnd.c from the source code of NetHack 2.2a. To link to a particular line, write [[NetHack 2.2a/rnd.c#line123]], for example. Warning! This is the source code from an old release. For the latest release, see Source code 1. /* SCCS Id: @(#)rnd.c 2.0 87/09/15 2. */ 3. #include "config.h" 4. #ifdef UNIX 5. #define RND(x) (random() % (x)) 6. #else 7. /* Good luck: the bottom order bits are cyclic. */ 8. #define RND(x) ((rand()>>3) % (x)) 9. #endif 10. 11. rn1(x,y) /* y <= rn1(x,y) < (y+x) */ 12. register x,y; 13. { 14. return(RND(x)+y); 15. } 16. 17. rn2(x) /* 0 <= rn2(x) < x */ 18. register x; 19. { 20. return(RND(x)); 21. } 22. 23. rnd(x) /* 1 <= rnd(x) <= x */ 24. register x; 25. { 26. return(RND(x)+1); 27. } 28. 29. d(n,x) /* n <= d(n,x) <= (n*x) */ 30. register n,x; 31. { 32. register tmp = n; 33. 34. while(n--) tmp += RND(x); 35. return(tmp); 36. } 37. 38. rne(x) /* by stewr 870807 */ 39. register x; 40. { 41. register tmp = 1; 42. while(!rn2(x)) tmp++; 43. return(tmp); 44. } 45. 46. rnz(x) 47. register x; 48. { 49. register tmp = 1000; 50. tmp += rn2(1000); 51. tmp *= rne(4); 52. if (rn2(2)) { x *= tmp; x /= 1000; } 53. else { x *= 1000; x /= tmp; } 54. return(x); 55. }
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software