I Want to create car selling mission but i dont know how to create random integer between a and b can someone help?
Quote from: EK.IceFlake on Feb 06, 2015, 05:16 AMHi, guys! After a bit of number-quenching and guesswork, I finally came up with my function that takes a random number from rand() and does some maths to make the from and to function work! It supports negative numbers, too. And also a mixture of negative and positive.
Here is the code:
function Random(from, to) return (rand()*(to+1-from)) / (RAND_MAX+1)+from;
Purely tested.
Hope you like it!
local n = Random(1000, 2000)
Fixed