Random Number for Transaction Signatures In R Values , how It is created?

I wonder about the random Number used in signatures that result in R values ?
xcoridnate R = G(k)
how it is created ? does it have specific chars length ?
Is there a specific Random generator Used ? or restriction Arguments ?
I saw A Python Code online and found It is limited to max number of field points
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
but as it is in hex format i didn’t know what does it mean
so wat is the max number to be used as it will processed as an integer

probability distributions – Geometry interpretation of any continuous random variable

Given a continuous random variable $X$ with the cdf $F_X(x)$, I want to know whether there exists a random variable $mathbf{Z}$ uniformly distributed in a geometry region $mathscr{Z}_n$ in $mathbb{R}^n$ such that any one-dimensional marginal distribution $F_{mathscr{Z}_n}^1$ of $mathbf{Z}$ is close to the distribution of $X$. In addition, an asymptotic perspective is also welcome. For example, it is also meaningful to know whether $F_{mathscr{Z}_n}^1=F_X$ is possible if $n$ tends to $+infty$.


Some useful facts are given as follows:

  1. A normal distribution can be approximated by a uniform random variable distributed in a hypersphere.
  2. A negative exponential distribution can be approximated by a uniform random variable distributed in a simplex.

This question has been asked in enter link description here yesterday.

pr.probability – Converse for the central limit theorem of $q$-dependent random variables

Let $(X_n)_n$ be a sequence of $q$-dependent random variables and identically distributed. If $E(X_1^2)<+infty,$ then the Hoeffding-Robbins theorem states that $$frac{1}{sqrt{n}}sum_{k=1}^n(X_k-E(X_k)) Rightarrow N(0,sigma^2).$$

The converse seems to be true, that is if $frac{1}{sqrt{n}}sum_{k=1}^nX_k$ converges in distribution to a random variable $X$ then $E(X_1^2)<+infty,$ in particular when $q=0$: https://math.stackexchange.com/questions/3202451/central-limit-theorem-and-integrability/3623412#3623412 and https://math.stackexchange.com/questions/3961865/central-limit-theorem-for-weighted-random-variable

The converse, does it hold if $q>0$ ? Is there any proof, paper, reference… for this?

probability – Random signs inequality

Let $X_1, X_2, dots, X_n, dots$ be Rademacher random variables (random signs), i.e. with the distribution
$$X_i sim left{
begin{array}{@{}ll@{}}
1 & text{with probability} frac{1}{2},\
-1 & text{with probability} frac{1}{2}.
end{array}right.$$

Now, let us fix $yinell^2$ – meaning that $y=(y_i)_{i=1}^{infty}$. How to prove that
$$Bigg(mathbb{E}Bigg|sum_{i=1}^{infty} y_iX_iBigg|^{p}Bigg)^{frac{1}{p}}le sqrt{p}Bigg(sum_{i=1}^{infty}y_i^2Bigg)^{frac{1}{2}}?$$
I have found it in a paper being called a “standard inequality”, but I am stuck on how to obtain
this $sqrt{p}$ factor. I will be glad for any help or insight.

pr.probability – Design a random variable which has the maximal correlation with another random variable

$Y$ is a Gaussian distributed random variable with zero mean and known variance: $Ysim N(0,sigma_y)$. We measure $Y$ with a sensor, which is corrupted by white Gaussian noise: $Z=Y+V$; $Vsim N(0,sigma_v)$.

How can I design a random variable $X$ depending on $Z$, $sigma_y$, $sigma_v$, and $sigma_x$ which results in $X$ having the distribution $Xsim N(0,sigma_x)$ and having a maximal correlation with $Y$?

Initial idea: We can take $hat{Y}$, the minimum mean square estimation (MMSE) of $Y$, and let $X=that{Y}$ with $t$ chosen to ensure that $X$ has the desired variance. But later I found this intuitive idea is not correct. I wonder if someone can answer this question.

c++ – Generating random permutation with forced change of order (Secret Santa)

I wrote this function to generate random permutation of input vector, while making sure every element has switched place (for a Secret Santa like purpose).

std::map<std::string, std::string> getPermutation(const std::vector<std::string>& participants)
{
  auto permuted = participants;
  std::random_device rd;
  std::mt19937 g(rd());
  bool correctlyPermuted = false;
  while(!correctlyPermuted)
  {
    std::shuffle(permuted.begin(), permuted.end(), g);
    auto res = std::mismatch(participants.begin(), participants.end(), permuted.begin(), std::not_equal_to{});
    if(res.first == participants.end())
    {
      correctlyPermuted = true;
    }
  }
  
  std::map<std::string, std::string> result;
  for(int i = 0; i < participants.size(); ++i)
  {
    result(participants(i)) = permuted(i);
  }
  return result;
}

You can run code here. Note that’s still work in progress, I’m mostly concerned about the function above.

participants is guaranteed to contain no duplicate elements.

I’m not really concerned with speed – it’s supposed to be executed by humans, they are unlikely to notice any performance improvement. Of course, you are welcome to point any obvious performance issues.
However, I’m concerned with the readability of the function, particularly with the use of std::mismatch to find actually matching elements. It feels too clever, but maybe it’s just good use of functional programming and I’m overthinking? It also seems too long for a good function (22 lines), but I can’t think of how it could be splitted/shortened logically.

java – How do i efficiently read random lines from a TXT or CSV file?

Context of the problem:

  1. I have made chess GUI (Java)
  2. The GUI is capable of loading chess puzzles/problems to solve
  3. Of said puzzles, i have gotten my hands on a database which is just shy of a million entries

The problem/question:
How does one most efficiently go about getting a random puzzle from this database?

Obviously keeping the database in memory is not an option, despite it already being compressed. Stripped all data that isn’t needed from it and in the end converted it into byte-arrays. All to no avail. The full database always ends up taking up somewhere between 100 and 200 MB of memory. A tenth of that would be acceptable (for my purposes).

Even worse: When processing the entire database (in attempts to keep it all in memory), the process file->memory took upwards of 700 MB memory.

Let’s say i have the following:

  • The database as either a txt or csv file
  • The amount of lines in said file (which is equal to the amount of puzzles)

Am i with that, in some way, capable of grabbing either a random or specific puzzle from the file (albeit async, that doesn’t matter) without having to load the entire database into memory?

Thanks for your time!

random – Python Turtle Race Restart Function

I just got done with my first Turtle Race and still had one assignment left, a restart function. I just cant get it to work as i want. The goal is, an output of a question: Restart? y or n, and that’ll restart the race() function and start a completly new race. I am really in need of your guys’ help.

from turtle import *
from random import randint


Andi = Turtle("turtle")
Andi.color("red")
Andi.shape("turtle")
Andi.penup()
Andi.goto(-300,200)
Andi.pendown()

Dom = Turtle("turtle")
Dom.color("green")
Dom.shape("turtle")
Dom.penup()
Dom.setpos(-300,180)
Dom.pendown()

Pete = Turtle("turtle")
Pete.color("blue")
Pete.shape("turtle")
Pete.penup()
Pete.setpos(-300,160)
Pete.pendown()

Emir = Turtle("turtle")
Emir.color("yellow")
Emir.shape("turtle")
Emir.penup()
Emir.setpos(-300,220)
Emir.pendown()

windowcolor=Screen()
windowcolor.bgcolor("black")

turtles = (Emir, Pete, Dom, Andi)
def race():
    global turtles
    winner = False
    finishline = 300

    while not winner:
        for current_turtle in turtles:
            move = randint(0, 10)
            current_turtle.forward(move)
            xcor = current_turtle.xcor()
            if (xcor > finishline):
                winner = True
                current_turtle.forward(0)
                winner_color = current_turtle.color()
                print('The winner is', winner_color(1))
def restart():
    global turtles
    while race():
        turtle.clear()                
race ()
restart ()
while True:
    while True:
        answer = str(input("Restart? (y/n): "))
        if answer in ("y", "n"):
            break
        print("Invalid awnser")
    if answer == "y":
        race
    else:
        print("Shutting off")
        break

windowcolor.mainloop()

while True:
    windowcolor.update()

What am I doing wrong, in my restart() function?

random – Python Turtle Race with winner output

bashBedlam showed how to make it work, but you could write it better in a few ways.

You could make each turtle object in a for-loop that iterates through a list of colors and y-coordinates. Then you could add each turtle to a list at the end of each of each loop.

You could also pass the turtle list to the race function instead of having the function look for the list in the global scope. It doesn’t matter very much here, but avoiding working with global variables is a good habit to get into since global variables can potentially make it harder to debug more complicated programs.

Something that might be seen as a bug is the fact that multiple turtles can pass the finish line in the same loop through the while block. If this happens then it will print “the winner is color” for each turtle that got to the end. If that’s not intended, an easy way fix it would be to put a break statement at the end of the if block. If it is intended then you don’t need to do anything.

If the thing mentioned above is unintended, another issue after fixing it will be that the turtles closer to the beginning of the turtle list will be at an advantage since they start moving earlier. You could deal with this by using the shuffle function from the random module to shuffle the turtle list, probably at the start of the race function since your goal is to be able to call it repeatedly. Since each of the turtles will be put in a random position in the list, none of them will have any definite, permanent advantage.

This part belongs better at stackoverflow.com instead of at this site, but to make a restart function, all you need to do is make a function that puts each of the turtles back at x coordinate -300 and clears their lines. At that point the race function should be ready to be called again.

You accidentally wrote Turtle("turtle") instead of just Turtle() in a few places.

current_turtle.forward(0) doesn’t do anything.

Random CMD opens up every 10 minutes

I’ve noticed that an unknown cmd opens up exactly every 10 minutes and disappears almost instantly. To try and figure out what’s doing this i downloaded an application called focus.exe which prints out the pid and application that stole the focus. The log shows this:

23228:C:WindowsSystem32cmd.exe | Fri Jan 15 17:16:50 2021
13640:C:Program Files (x86)GoogleChromeApplicationchrome.exe | Fri Jan 15 17:16:50 2021
26704:C:WindowsSystem32cmd.exe | Fri Jan 15 17:26:50 2021
13640:C:Program Files (x86)GoogleChromeApplicationchrome.exe | Fri Jan 15 17:26:50 2021
31644:C:WindowsSystem32cmd.exe | Fri Jan 15 17:36:50 2021
13640:C:Program Files (x86)GoogleChromeApplicationchrome.exe | Fri Jan 15 17:36:50 2021
21264:C:WindowsSystem32cmd.exe | Fri Jan 15 17:46:50 2021
13640:C:Program Files (x86)GoogleChromeApplicationchrome.exe | Fri Jan 15 17:46:50 2021
17032:C:WindowsSystem32cmd.exe | Fri Jan 15 18:06:50 2021

I need help finding out what’s causing this. I googled and found some some old bug with an office background task but i’ve looked and it doesn’t seem to be the same problem (it’s been patched as well).
Does anyone have a clue what could cause this? My games get tabbed when this happens.

I do not think that chrome has anything to do with this, i believe chrome was in focus and when cmd opened up and closed chrome went back to focus.