How to generate random numbers, strings and select a random choice from a drop down list in Watin?
By : web surfer
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I do have some opinions on testing with non deterministic data, but I'll keep them to myself as I don't know the background :) I don't know of any builtin functionality for that, but you can easily add your own methods to do it; code :
static string RandomString(int len)
{
var random = new Random();
return new string(Enumerable.Range(1, len)
.Select(_ => (char)(random.Next() % 95 + 33)).ToArray());
}
static string RandomDigits(int len)
{
var random = new Random();
return new string(Enumerable.Range(1, len)
.Select(_ => (char) (random.Next()%10 + '0')).ToArray());
}
ieInUse.TextField(Find.ById("Blah")).TypeText(RandomString(7));
ieInUse.GoTo("http://randomwebsite/Description/" + RandomDigits(2));

Getting numbers based on list of other numbers in matlab / octave
By : Hyungkeun Choi
Date : March 29 2020, 07:55 AM
Hope this helps When I type in (1:4:16) in matlab / octave I get 1,5,9,13 as the answer , you can use this function: code :
function num = getTheMissingNumbers( from, jump, to )
num = from:to;
num = setdiff( num, from:jump:to );
>> getTheMissingNumbers( 1, 4, 16 )
function num = getTheMissingNumbers( jump, to )
num = 1:to;
num(1:jump:to) = []; % remove the elements in ind

Populating Multi dimensional array in octave/matlab to create waterfall plot in octave / matlab
By : Metin Aytekin
Date : March 29 2020, 07:55 AM
hop of those help? Your error is here: ma(:,:,k)=[ma;ma_tmp]; You are mixing up two concepts. code :
ma = [ma; ma_tmp];
ma(:,:,k) = ma_tmp;

python, select random #k numbers from (1, n) excluding numbers in list
By : Shini
Date : March 29 2020, 07:55 AM
will be helpful for those in need Sample notes in sample's docstring: code :
In [11]: sample(range(100000000), 3)
Out[11]: [70147105, 27647494, 41615897]
In [12]: list(range(100000000)) # crash/takes a long time
import bisect
import random
def sample_excluding(n, k, excluding):
# if we assume excluding is unique and sorted we can avoid the set usage...
skips = [j  i for i, j in enumerate(sorted(set(excluding)))]
s = random.sample(range(n  len(skips)), k)
return [i + bisect.bisect_right(skips, i) for i in s]
In [21]: sample_excluding(10, 3, [2, 4, 7])
Out[21]: [6, 3, 9]
In [22]: sample_excluding(10, 3, [1, 2, 8])
Out[22]: [0, 4, 3]
In [23]: sample_excluding(10, 6, [1, 2, 8])
Out[23]: [0, 7, 9, 6, 3, 5]
In [24]: sample_excluding(10000000, 6, [1, 2, 8])
Out[24]: [1495143, 270716, 9490477, 2570599, 8450517, 8283229]

How can I select a random numbers from an array in matlab in a repeating way?
By : user3359342
Date : March 29 2020, 07:55 AM
wish of those help I have an array name time with 1 row and 1000 columns. code :
len = length(time); % length of the vector
time7 = zeros(1,len) ; % initilaize the vector time7 to store your time7
common_time = 5;
for iValue = 1:len
% randi used to get a random value
time2 = time(randi([1, len], 1));
time3 = time(randi([1, len], 1));
time4 = (time2 + time3)/2;
time5 = time(randi([1, len], 1));
time6 = common_time  time5;
time7(iValue) = time4  time6;
end

