I need to pick a random number from 1-28.
I could use
SCAR Code:Case Random(27) of
0:1
1:2
2:3
3:4
4:5
5:6
6:Stupid and boring
end;
Anything more professional i could use?
I need to pick a random number from 1-28.
I could use
SCAR Code:Case Random(27) of
0:1
1:2
2:3
3:4
4:5
5:6
6:Stupid and boring
end;
Anything more professional i could use?
Last edited by Mr. Doctor; 10-31-2009 at 10:16 PM.
You don't have to number every case, unless you have 28 things to be done.
Also note that Random() starts from 0, so you are missing case 0, which will be a problem if nothing is assigned to 0?
(Simple fix: Case (1+Random28) of)
I don't really know what you're trying to do, but I assume it's an anti-ban procedure and which I don't see any better way to do it.
Pick a random number with a range from 1-28. Its use is confidential.
Writeln(IntToStr(1+Random(28)));?
I really don't know what you are trying to do because it's as simple as using one of two procedures.SCAR Code:Writeln(IntToStr(RandomRange(1, 28)));
PHP Code:function Random(Range: Integer): Integer;
Returns random 0 <= number < Range. Random(5) will return any of values 0, 1, 2, 3, 4. Random(5) + 1 will return values 1..5.
function RandomRange(From, To: Integer): Integer;
Returns a random value between From and To.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
I'll use randomrange. Thanks guys.
There are currently 1 users browsing this thread. (0 members and 1 guests)