Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // At Top
- #include <cstdlib>
- #include <time.h>
- // Initialise Random
- srand(time ( 0 ));
- // Call Rand
- Rand();
- RANDOM COLOUR
- // Makes a new random colour
- Colour fillColour(rand()%256, rand()%256, rand()%256);
- // Sets random colour
- Gwin.setFillColour(fillColour);
- LIMITING RANDOM
- // Limiting Random From 1 - 3
- 1 + rand() % 3;
- // Limiting Random 0 - 200
- rand() % 100
- // Limiting Random 50 - 100
- 50 + rand() & 100;
- RANDOM WIDTH AND HEIGHT
- // Gets current height and assigns to height
- int height = Gwin.getHeight();
- // Gets current width and assigns to width
- int width = Gwin.getWidth();
- // Sets a radom width to x
- int x = rand()%width;
- // Sets a random height to y
- int y = rand()%height;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement