random – How to display an image pixel by pixel randomly

I want to display an image that each pixel appears randomly, the final result is an image without noise. I have tried this, but the result is not what I expected, How should I fix it?

img=ExampleData[{"TestImage","Lena"}];
data=ImageData[img];
{w,h}=ImageDimensions[img];
constArr=ConstantArray[N@{1,1,1},{h,w}];

Manipulate[constArr[[1;;i,1;;j]]=RandomSample@data[[1;;i,1;;j]];Image[constArr],{i,1,h,1},{j,1,w,1}]

enter image description here

How to skip random checking while booting Ubuntu on ASUS

I would like to know how to skip this part that my laptop does before loading ubuntu. Everytime i boot up, it loads so much stuff as it is seen in the image below. How do i get my laptop to boot directly to Ubuntu? Iewbie here. just installed Ubuntu on my hard drive after wiping it clean. It is not a dual boot.(https://i.stack.imgur.com/Frvov.jpg)

golden ratio – How to calculate phi with a random number generator?

I recently saw this as an interview question and was completely stumped by it..

Calculate phi using numpy.random.uniform

I was thinking $$a + frac{b}{a} = frac{a}{b} $$

might be useful in that you could simply generate random numbers between 0 and 1 and assign to $A$. You can then generate a new number from 0 to 1 and keep it if it satisfied the equality. In the end you can just divide the means of the generated quanitities.

network topology – What is a distributed algorithm for generating random “private” pair-matchings?

Say you have 2N named peers (agents) able to address each other by their name and communicate freely among them.
What distributed algorithm could they use in order to randomly pair up? The final situation would be that the agents were able to organize themselves in N random couples. On different runs the random couples should be different.

Important: the algorithm should be “private” in the following sense: at the end of the round, each agent should only know the name of agent it was paired with.

random – How to count the amount of times an element appears seperately within a nested list

Beginner at using Mathematica, and having trouble with nested lists. For example, the following output for 15 coinflips every day for a year:

cointoss1 = Table[cointoss2 = RandomChoice[{"H", "T"}, 15], 365]

Which gives an output like:

{{"H", "T", "H", "T", "T", "T", "T", "T", "H", "T", "T", "H", "H", 
  "T", "T"}, {"H", "H", "H", "T", "H", "T", "H", "H", "H", "T", "T", 
  "H", "T", "H", "T"}...

My question is how would I be able to count the number of times I get a certain element in the list. For example, If I wanted to count how many heads I get within each list how would I go about doing it. I’ve tried using count –

Count[cointoss1, "H"]

Every time I tried it I have gotten an output of 0. I want to get it in a list like output for the number of heads in each list:
{5,8,…}
Another thing I want to find is the number of lists with x or more heads. So how would I go about doing this? Apologies for the bad formatting, this is my first question.

django – Generating random string (for unique code) keeps returning the same random string

I have a Test model where each test can be identified by a unique randomly-generated string:

class Test(models.Model):
    code_length = 7
    code = models.CharField(max_length=code_length, editable=False, default=generate_id(code_length))
    name = models.CharField(max_length=100, default=None)
    user = models.ForeignKey(User, on_delete=models.CASCADE)

    def __str__(self):
        return "Code: {} | Username: {} | Test: {}".format(self.code, self.user.username, self.name)

def generate_id(length):
    return get_random_string(length)

Tbh, it was working good before. It started to “bugged-out” after I updated my Django from Django 1.x to Django 3.xm and I also cleared all the records of the Test model in django-admin (I want to have a fresh and clean database for testing). Right now, whenever I try and create a new Test, it’s code is literally the same with all other new Tests that I create:

enter image description here

I think I haven’t done anything to it other than those two changes I made. Any ideas? Thanks a lot!

8 – When I create or modify a page, a random URL is created

Usually I set an URL with the title of the page, but even if I set the URL I would like, I got a 404 error if I try to visit a page using that URL, but if I try to visit the page from the contents list, the page has a random link that comes from another website installed on the server using drupal (different installation, not on multi-site).
Is there a way to get rid of this random-generation and use the URL I set?
Thanks in advane

random variables – When X is r.v with exponential distribution then X-a is r.v with Exponential distribution too? (a is a constant)

When r.v. $X$ ~ Expo($lambda$) then r.v. $(X-a)$ ~ Expo($lambda$) ?

Let $Y = X-a$.

CDF of $Y$ : $P(Y < y) = P(X-a < y) = P(X < a+y) = 1-e^{lambda(a+y)}$

It doesn’t seem like $Y$ is not r.v with Expo$(lambda)$ but i want to make sure whether my logic is correct.

And i wanna know why given $X$ ~ Expo($lambda$), $E(X|X>a) = a + E(X-a|X>a) = a + E(X)$

I really would be appreciated if you enlighten me, Thanks!

pr.probability – Projection of a random vector distributed uniformly on the cube

Let $Ainmathbb{R}^{mtimes k}$ be a fixed matrix with $m<k$, and let $X$ be a random vector distributed uniformly on the $k$-cube ${-1,1}^{k}$.

What is the distribution of $Y=AX$?

Denoting by $a_{i}^{top}$ the $i$th row of $A$, we can see that the $i$th entry of $Y$ can take (at most) $2^{k}$ possible values from ${a_{i1}+cdots+a_{ik},ldots,-a_{i1}-cdots-a_{ik}}$, and each of these is equally likely. How do I compute the full joint distribution? Any hints appreciated.

(Also posted on Math StackExchange)

Docker container with random date

I was running a container based on the image linuxserver/radarr:3.0.0.3095-ls12.
Once I updated the tag/version to linuxserver/radarr:3.0.0.3807-ls24 the application stopped working.

After debugging a little I noticed that date behaves weirdly in this image:

$ docker run --rm --entrypoint "" linuxserver/radarr:3.0.0.3807-ls24 date
Fri 20 Feb 1970 03:17:15 AM UTC
$ docker run --rm --entrypoint "" linuxserver/radarr:3.0.0.3807-ls24 date
Sun 01 Mar 1970 09:09:15 AM UTC
$ docker run --rm --entrypoint "" linuxserver/radarr:3.0.0.3807-ls24 date
Thu 19 Feb 1970 09:04:59 AM UTC

But the old doesn’t

$ docker run --rm --entrypoint "" linuxserver/radarr:3.0.0.3095-ls12 date
Sat 10 Oct 2020 12:15:09 AM UTC

After meditating for a while, assuming some kind of weird dark magic in the clock, decided to run it with --privileged for full/raw access

$ docker run --rm --entrypoint "" --privileged linuxserver/radarr:3.0.0.3807-ls24 date
Sat 10 Oct 2020 12:16:22 AM UTC

And it worked well (and so did the app, but not important to the question).

I have gone through docker history of both images but a lot of COPY and RUN curl that might have different results between builds. Still, I don’t think anyone (image maintainers) would want to mangle with the date, so it must be something out of their control (no libfaketime found)…

This is a multi-arch image and these results are from a raspberry Pi (so the arm build of the image). In my amd64 linux laptop, the latest image reports proper date even without privileged…

What could it be? How can I even start to debug this as I cannot use the --privileged flag?