SRL Archive - Help and Support

Question


Junior

2007-02-18 02:13:04

WARNING: This is a stupid question!

Alrighty, I was thinking of something but I dont know the best way to do this. How do you make SCAR pick a random number between 2 numbers? Like if I had numbers starting from 200, and ending at 400, how would I make SCAR pick a random number in between? I was thinking about arrays, but is there anything better then that?

just made this, is this any good?
program New;
{.include SRL/SRL.scar}

function betweennum(start, finish: integer): integer;
begin
result := start + random(finish - start);
end;

begin
writeln('random number from 200 to 400 is: ' + inttostr(betweennum(200, 400)));
end.

P.S.
I still cant get that bitmap mask to work, I talked about it in a earlier thread.

Meanage

2007-02-18 02:22:38

would something like number:= (200+random(200)) work? youve probably thought of this and it prob doesnt work so yeah…

also the link for you aircrafter needs updating

Junior

2007-02-18 02:36:38

I think what your saying will work, what a stupid ass question that was! I guesse im too tired for SCAR atm. And yea, ill update the link to my air crafter when I release the newest version. :stirthepot:

Boreas

2007-02-18 09:34:57

Yea you got it.

//*************************************************************************
//Randomrange(10,15) can return 10, 11, 12, 13, 14, or 15
function randomrange(min,max: integer):integer;
begin
result:=random((max-min)+1)+min;
end;
//*************************************************************************