How To Randomize Photos On A Memory Key How Do You Randomize Between Two Variables?
How do you randomize between two variables? - how to randomize photos on a memory key
M Turbo Pascal V1.5 'attempt at random:
I do my random (variable) of a random number between my other variables (number1) and (number2)
How do I do that?
2 comments:
EDIT:
Oops, I forgot something.
The below MyVar2 variable is the maximum number that you want, ie, less the value of MyVar1 (MyVar2 = MyVar2 - MyVar1). If this does not happen, then it is possible that the random number is greater than the maximum random error value that you want.
-----------
I was surfing the Internet to find the code to create random numbers with Pascal, I found here:
http://www.programmersheaven.com/mb/pasp ...
Under the assumption that the code displayed in the link is correct, you would do something like this:
var
MyVar1: Integer;
MyVar2: Integer;
begin
(Declaration of MyVar1 and MyVar2 here)
Randomize; (the random number generator)
RandNum: = Random (MyVar2) + MyVar1; (Generate a random number between MyVar1 and MyVar2 (inclusive))
end;
The first part of the line "randNum", Random (MyVar2) is a random number between 0 and the value of MyVar2. The "+ MyVar1 am a partCHANGE income and the minimum is always generate a value MyVar1. (Make sure that the variable is the variable MyVar1 use less and less worth than the value of 'MyVar2')
I give the C + + code that will help the
# \\ \\ Include \\ \\ \\ \\ u0026lt; iostream>
# \\ \\ Include \\ \\ \\ \\ u0026lt; ctime>
# \\ \\ Include \\ \\ \\ \\ u0026lt; cstdlib>
using namespace std;
int main ()
(
srand ((unsigned) time (0));
random_integer int;
int lowest = 1, highest = 10;
\\ \\ \\ \\ \\ \\ \\ \\ U0026lt, int high class = "highlight"> Rank \\ \\ \\ \\ \\ \\ \\ \\ u0026lt; / strong> = (highest ...
for (int i = 0; index \\ \\ \\ \\ \\ \\ \\ \\ u0026lt, 20, i + +) (
random_integer = lowest + int (range * rand () / (RAND_MAX + 1.0));
\\ \\ \\ \\ Court \\ \\ \\ \\ u0026lt \\ \\ \\ \\ \\ \\ \\ \\ u0026lt; random_integer \\ \\ \\ \\ \\ \\ \\ \\ u0026lt \\ \\ \\ \\ \\ \\ \\ \\ u0026lt; endl;
)
)
Post a Comment