#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int geraAleatorio(int min, int max) {
return ((rand() % (max
- min
)) + min
) + 1; }
int main(void) {
printf("%d\n", geraAleatorio
(10, 20)); printf("%d\n", geraAleatorio
(10, 20)); printf("%d\n", geraAleatorio
(30, 40)); }
//http://pt.stackoverflow.com/q/186730/101
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUuaD4KCmludCBnZXJhQWxlYXRvcmlvKGludCBtaW4sIGludCBtYXgpIHsKICAgIHJldHVybiAoKHJhbmQoKSAlIChtYXggLSBtaW4pKSArIG1pbikgKyAxOwp9CgppbnQgbWFpbih2b2lkKSB7CglzcmFuZCgodW5zaWduZWQpdGltZShOVUxMKSk7CglwcmludGYoIiVkXG4iLCBnZXJhQWxlYXRvcmlvKDEwLCAyMCkpOwoJcHJpbnRmKCIlZFxuIiwgZ2VyYUFsZWF0b3JpbygxMCwgMjApKTsKCXByaW50ZigiJWRcbiIsIGdlcmFBbGVhdG9yaW8oMzAsIDQwKSk7Cn0KCi8vaHR0cDovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMTg2NzMwLzEwMQ==