Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // At Top
  2. #include <cstdlib>
  3. #include <time.h>
  4.  
  5. // Initialise Random
  6. srand(time ( 0 ));
  7.  
  8. // Call Rand
  9. Rand();
  10.  
  11.  
  12.  
  13.  
  14.  
  15. RANDOM COLOUR
  16.  
  17. // Makes a new random colour
  18. Colour fillColour(rand()%256, rand()%256, rand()%256);
  19.  
  20. // Sets random colour
  21. Gwin.setFillColour(fillColour);
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. LIMITING RANDOM
  29.  
  30. // Limiting Random From 1 - 3
  31. 1 + rand() % 3;
  32.  
  33. // Limiting Random 0 - 200
  34. rand() % 100
  35.  
  36. // Limiting Random 50 - 100
  37. 50 + rand() & 100;
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. RANDOM WIDTH AND HEIGHT
  45.  
  46. // Gets current height and assigns to height
  47. int height = Gwin.getHeight();
  48.  
  49. // Gets current width and assigns to width
  50. int width = Gwin.getWidth();
  51.  
  52.  
  53. // Sets a radom width to x
  54. int x = rand()%width;
  55.  
  56. // Sets a random height to y
  57. int y = rand()%height;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement