Advertisement
Weegee

Untitled

Aug 7th, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. int get_randypos(struct coordinates geometry_win, struct obstacleinfo *oi)
  2. {
  3. int i;
  4. int randpos;
  5.  
  6. randpos = rand() % ((geometry_win.y - 2) - 1 + 1) + 1;
  7. for (i = 0; i < oi->count; i++)
  8. {
  9. while (1)
  10. {
  11. if (oi->obstacle[i]->y_pos == randpos)
  12. {
  13. randpos = rand() % ((geometry_win.y - 2) - 1 + 1) + 1;
  14. }
  15. else
  16. {
  17. break;
  18. }
  19. }
  20. }
  21.  
  22. return randpos;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement