This gives random number between hi and lo ( if 1 and 4 are given, then either 1, 2, 3 are displayed. But my question is, if 1 and 3 are given then I want to display either 1 or 3, no number between them.

You have little choice but to either collect the numbers into an array (or other collection) and then randomly select from the array, or filter out any generated numbers that aren't the ones you want.

For 1 and 3, but one of your test cases for rejecting the range suggestion was 1 and 4 being "given". This suggests that the numbers are unknown input from a user or stream. If you'll only ever be given two numbers then this approach is valid, but if you have an unknown amount of unknown numbers in an unknown range, it gets tedious very quickly. In fact, this is a manual version of my suggestion to collect the numbers in an array and randomly select from the array.

But is there any way I can do this within rand() ?

Not unless you have control over the source code of rand(), which is extremely unlikely. I say unlikely rather than impossible because it's possible to write your own version of the standard library and replace the one that came with your compiler. I do this myself, but it's not a trivial project.

Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...