random

Copy random 25 files from 1300 to another folder with VBA

我与影子孤独终老i 提交于 2021-02-11 12:40:41
问题 I have 1300 excel files on a server, with revenues in them. I need to compare these revenues with one pivot file to make sure the revenues are the same in the actual 2 files. Because it is on a server, opening all of them from a server would be pretty slow, thats why I want to copy a sample of them (25 excel files) to my compter first, and then run my comparison macro from this folder. But I want to make the copying process automatized, so I somehow need to select randomly 25 of these files,

How can Python use n, min, max, mean, std, 25%, 50%, 75%, Skew, Kurtosis to define a psudo-random Probability Density Estimate/Function?

試著忘記壹切 提交于 2021-02-11 12:29:27
问题 In reading and experimenting with numpy.random, I can't seem to find or create what I need; a 10 parameter Python pseudo-random value generator including count, min, max, mean, sd, 25th%ile, 50th%ile (median), 75th%ile, skew, and kurtosis. From https://docs.python.org/3/library/random.html I see these distributions uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions, though I need to generate values directly to a distribution defined only by my 10

Choose n random elements from every row of list of list

假如想象 提交于 2021-02-11 12:17:42
问题 I have a list of list L as : [ [1,2,3,4,5,6], [10,20,30,40,50,60], [11,12,113,4,15,6], ] Inner list are of same size. I want to choose n-random elements from every row of L and output it as same list of list. I tried the following code: import random import math len_f=len(L) index=[i for i in range(len_f)] RANDOM_INDEX=random.sample(index, 5)) I am stuck at this point that how can I use random index to get output from L. The output for "2" random elements would be: [ [1,6], [10,60], [11,6], ]

Choose n random elements from every row of list of list

强颜欢笑 提交于 2021-02-11 12:16:56
问题 I have a list of list L as : [ [1,2,3,4,5,6], [10,20,30,40,50,60], [11,12,113,4,15,6], ] Inner list are of same size. I want to choose n-random elements from every row of L and output it as same list of list. I tried the following code: import random import math len_f=len(L) index=[i for i in range(len_f)] RANDOM_INDEX=random.sample(index, 5)) I am stuck at this point that how can I use random index to get output from L. The output for "2" random elements would be: [ [1,6], [10,60], [11,6], ]

There is a missing attribute in the chromosome in genetic algorithm

你离开我真会死。 提交于 2021-02-11 09:15:37
问题 I'm building a model about airline scheduling by using genetic algorithms that generate a flight schedule on a daily basis and assigning the right aircraft too. Each chromosome represents a total of 50 flight legs a day(including the return trip that means 100 trips a day) and I have 42 legs, so obviously there will be repeated flight legs. The initial members are created randomly, and there are some constraints that must be satisfied to have a valid schedule. The problem is one of the

What is a simple formula for a non-iterative random number sequence?

风格不统一 提交于 2021-02-10 23:41:14
问题 I would like to have a function f(x) that gives good pseudo-random numbers in uniform distribution according to value x. I am aware of linear congruential generators, however these work in iterations, i.e. I provide the initial seed and then I get a sequence of random values one by one. This is not what I want, because if a want to get let's say 200000th number in the sequence, I have to compute numbers 1 ... 199999. I need a function that is given by one simple formula that uses basic

How much does new Random() depends on time? [duplicate]

核能气质少年 提交于 2021-02-10 20:17:49
问题 This question already has answers here : Random number generator only generating one random number (10 answers) Closed 3 years ago . Yesterday I wrote my first answer at Programming Puzzles & Code Golf. The question said this: Given an input string S , print S followed by a non-empty separator in the following way: Step 1: S has a 1/2 chance of being printed, and a 1/2 chance for the program to terminate. Step 2: S has a 2/3 chance of being printed, and a 1/3 chance for the program to

Random numbers in haskell. And shuffling a list

强颜欢笑 提交于 2021-02-10 14:50:22
问题 i am trying to write a function that when given a list would return a lsit in random order. this is how i thought of doing it(the list is of length 52): generate random number between 1 and 52 take that element of the list. a = [1,2,3..] !! getRandom 52 then recursively call same function.. generate random number between 1 and 51 and call on list with first element we picked removed. (delete a [1,2,3..]) !! getRandom 51 And so on..after puting all elements picked in a list we get same list

How can I create a normal integer distribution in C++11?

你。 提交于 2021-02-10 13:07:40
问题 The normal distribution: std::normal_distribution<T> only accepts a real-valued type such as float or double , why doesn't it accept an integer type? How can I create a normal integer distribution? 回答1: I know next to nothing about C++11 but I know a little math (or I did at one point) and a discrete normal distribution is called a Binomial distribution. In fact a normal distribution is the binomial distribution when you let n go to infinity. So assuming C++11 has a binomial distribution then

Random.Next() How many iterations before a wrap around occurs?

笑着哭i 提交于 2021-02-10 06:15:00
问题 I'm pretty sure that this will never be an issue. However, I'm still curious, exactly how many iterations can any given seed generate a random number before its scope is fully exhausted and it wraps back around to generating the same numbers again? As an example: Suppose you have an array consisting of eight integer indices; during a given iteration the random.Next would fill each indice with a value of 0-31. And the test is attempting to see how long it would take to generate a perfect array