# Random Number

How you you make a declaeration so that you can achieve a number between 1 and 1000.

e.g.
__________________________________________________________________________
var
random_number:????????;(what do you enter and how do you set it between 1 and 1000)
__________________________________________________________________________

begin

• : How you you make a declaeration so that you can achieve a number between 1 and 1000.
:
: e.g.
: __________________________________________________________________________
: var
: random_number:????????;(what do you enter and how do you set it between 1 and 1000)
: __________________________________________________________________________
:
: begin
:

hi
You can , for example,declare a type:
type
number=1..1000;
and then declare a variable of this type:
var
random_number:number;

• : How you you make a declaeration so that you can achieve a number between 1 and 1000.
:
: e.g.
: __________________________________________________________________________
: var
: random_number:????????;(what do you enter and how do you set it between 1 and 1000)
: __________________________________________________________________________
DECLARATION: int random(int);
DEFINITION: random(1000);
("It will generate nos between 0 and 1000. So you may specify a condition incase it generates 1").
• : : How you you make a declaeration so that you can achieve a number between 1 and 1000.
: :
: : e.g.
: : __________________________________________________________________________
: : var
: : random_number:????????;(what do you enter and how do you set it between 1 and 1000)
: : __________________________________________________________________________
: DECLARATION: int random(int);
: DEFINITION: random(1000);
: ("It will generate nos between 0 and 1000. So you may specify a condition incase it generates 1").

Thanks for participating in the discussion, but this is actually a Pascal programming message board, not a C programming message board.

To answer the question, you would use something like this:

[code]
var
RandNum: Integer;
begin
Randomize; { Seed the random number generator }
RandNum := Random(1000) + 1; { Generage a random number between 1 and 1000 (inclusive) }
end;
[/code]