I want to know an algorithm to find unique random number which is non repeatable. Every time when I call that in program should be give a unique and random number which is not given before by that algorithm. I want to know because some time in a game or app this kind of requirements are came.   For ex. In a game I have created some objects and save all them in a array, and want to retrieve  them by randomly and uniquely and not want to delete from array. This is just a scenario.  I have tried some alternative but they are not good performance wise, never got answer of this question.  How it is possible programmatically?  Thanks in advance.
I'd like to generate unique random numbers between 0 and 1000 that never repeat (i.e. 6 doesn't show up twice), but that doesn't resort to something like an O(N) search of previous values to do it. Is this possible?
How to upgrade to MySQL 8.0? I have a Drupal site 8.6.10 on an Ubuntu server 18.04 with MySQL 5.7.25  I want to update MySQL to version 8.0  Here are the steps I followed :   I backed up my database. I uninstalled MySQL from my server with the commands :  $ sudo systemctl stop mysql $ sudo apt remove mysql-* $ sudo apt purge mysql-* $ sudo apt autoremove $ sudo dpkg -l | grep mysql | grep ii  I added the repository with the command :  $ wget https://repo.mysql.com//mysql-apt-config_0.8.12-1_all.deb  I installed the package with the command :  $ sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb            My problem :   I install MySQL with the command :  $ sudo apt update $ sudo apt install mysql-server    When I do step 5, it installs MySQL 5.7 why does not it install version 8 ? I am working on a git repository with a master branch and another topic branch. I have switched to topic branch and modified a file. Now, if I switched to master branch that same file is shown as modified.   For example:  git status in git-build branch:  # On branch git-build # Changes to be committed: #   (use "git reset HEAD &lt;file&gt;..." to unstage) # #       modified:   cvsup_current #   Switch to master branch  [root@redbull builder_scripts (git-build)]# git co master M       builder_scripts/cvsup_current Switched to branch "master"   git status in master branch  [root@redbull builder_scripts (master)]# git status # On branch master # Changes to be committed: #   (use "git reset HEAD &lt;file&gt;..." to unstage) # #       modified:   cvsup_current #   Why is that the file is shown as modified in master branch even though it was modified in git-build branch?   My understanding was that the branches are independent of each other and when I change from one branch to another the changes do not "spill over" from one branch to another. So I am obviously missing some thing here.   Anyone got a clue stick? Display header and footer in all PDF pages using VF My vf page     &lt;apex:page renderAs="pdf" Controller="testpdf1"&gt;     &lt;head&gt;         &lt;style type="text/css" media="print"&gt;             @page              {                 size: 8.5in 11in;/* width height */             }              @page              {                 @top-center                  {                     content: element(header);                 }                  @bottom-left                  {                     content: element(footer);                 }             }              div.header              {                 padding: 10px;                 position: running(header);             }              div.footer              {                 display: block;                 padding: 5px;                 position: running(footer);             }              .pagenumber:before              {                 content: counter(page);             }              .pagecount:before              {                 content: counter(pages);             }         &lt;/style&gt;     &lt;/head&gt;      &lt;div class="header"&gt;             &lt;div align="right"&gt;Header&lt;/div&gt;     &lt;/div&gt;      &lt;div class="footer"&gt;         &lt;div&gt;Page &lt;span class="pagenumber"/&gt; of &lt;span class="pagecount"/&gt;&lt;/div&gt;     &lt;/div&gt;      &lt;div class="content"&gt;         &lt;p&gt;             &lt;apex:repeat value="{!opp}" var="item"&gt;                 &lt;tr&gt;                     &lt;td class="tableContent"&gt;{!item.Name}&lt;/td&gt;                 &lt;/tr&gt;             &lt;/apex:repeat&gt;         &lt;/p&gt;     &lt;/div&gt; &lt;/apex:page&gt;   Controller  public class testpdf1 {     public list&lt;Account&gt; opp{get;set;}      public testpdf1()     {         opp=[SELECT Name  from Account limit 50];     } }   I am getting all records in pdf format but able to get header in first page only and i am not getting header from second pages how can i display header to all pages. Particular solution of $y''-4y'+5y = 4e^{2x} (\sin x)$ How do I find the particular solution of this second order inhomogenous differential equation? (Using undetermined coefficients).  $y''-4y'+5y = 4e^{2x} (\sin x)$  I can find the generel homogenous solutions but I need help for the particular. Right click not working on Ubuntu 18.04 I have installed Ubuntu 18.04 LTS on my HP Pavilion series laptop. After installing this version of Ubuntu, right click is not working of my touchpad. How can I solve this?  BTW:  does not have any solution which which is working for me. PS:- Problem remains after selection area in gnome-tweak-tool Time traveler asks archaeologist for help in transporting a girl from dinosaur Earth to present day Many decades ago, I read a short story about a time traveler who asks an archaeologist for help.  He convinces the archaeologist that he can time travel by bringing him back a freshly killed dinosaur (small one.)  The time traveler needs help because when traveling back in time to the age of the dinosaurs he met a girl and wants to transport her back to the present.  However only one person can travel in time at a time so he needs the archaeologist at the other end to wait for the girl.  The archaeologist agrees to help.  Unfortunately after the traveler goes back he and the girl find themselves in the middle of a battle between aliens on Earth.  They are chased by a dinosaur and never make it back to the present.  The archaeologist meanwhile is digging for evidence that the traveler went back in time and the story or my recollection of it ends with that. I need to find a bottleneck and need to accurately as possible measure time.  Is the following code snippet the best way to measure the performance?  DateTime startTime = DateTime.Now;  // Some execution process  DateTime endTime = DateTime.Now; TimeSpan totalTimeTaken = endTime.Subtract(startTime); Which Distribution Does the Data Point Belong to? I have two distributions which are derived from 2 separate sets of data. These distributions are not normal, and it is not clear at this point if they belong to any family of known pdfs (they are not symmetric either). Given a data point, I need to decide which distribution it is most likely to belong to. If these were normal distributions, I could do usual parametric tests and go from there, but in this case I am not sure how to proceed. I searched around a bit, but I couldn't find anything, probably because I am not using the right keywords. Any help is much appreciated.  Edit to clarify: I should have mentioned that it was univariate. I might as well explain the actual problem here as well. We have time-spent data for users on websites. We also have information on whether a user liked or disliked some of those sites (about 4% of all the sites). So we know the distribution of time spent for like and dislike. An obvious question, then, is for a random user who spent x amount of time, are they more likely to have liked the page or dislike the page. Our time spent information is based on seconds, so the distributions are really discreet, but in real life, they are continuous. I am trying to figure out how can I disable/hide the App Name in MacOS X Lion dock. I've also attached an image so you can see what I mean.    Someone has any idea about how can I hide that? Using vim with latex suite on two different computers, on one it's fine, but on the other my tikz pictures ''colapses'' (all text is put to the center of the figure, nothing is drawn) The same pc can compile fine from texstudio, but not from vim- latex suite  Edit: Seems the problem was compiling to dvi instead of pdf Show/Hide hidden files without restarting finder? I came to understand that the following is the way to toggle the visibility of hidden files:  defaults write com.apple.finder AppleShowAllFiles YES # replace YES with NO to hide hidden files killall -HUP Finder /System/Library/CoreServices/Finder.app   Is there a way to show/hide hidden files without killing the Finder? Inequality from Challenge and Thrill of Pre-college Mathematics Is it possible to make armour that can survive /kill? /kill is said to be infinity damage but I have a question can you really survive it in Java edition. However, it is possible that you can pretty much survive this if you are on Minecraft Java Edition in 1.8 or lower and you can just have resistance 5 and you will survive this but can you make armour that helps you survive in 1.16 and in java-edition. The special linear group $\text{SL}_n(\mathbb{R})$ is its own commutator Let $SL_n(\mathbb{R})$ be the set of $n\times n$ matrix with determinant one. Where can I find a proof that $[SL_n(\mathbb{R}),SL_n(\mathbb{R})]=SL_n(\mathbb{R})$? I've seen this result mentioned in several places, but couldn't find a proof.  For reference, the commutator $[SL_n(\mathbb{R}),SL_n(\mathbb{R})]$ is defined as the group generated by the set of all elements of the form $a^{-1}b^{-1}ab$, with $a,b\in SL_n(\mathbb{R})$. Detecting TCP Client Disconnect How can I import an obj sequence into blender? I have an obj sequence of a fluid simulation from Realflow. I've found a few tools that can import an obj sequence into blender, but most are outdated and don't work. Are there any scripts or plug-ins that can do that? How to elegantly ignore some return values of a MATLAB function Proving that closed (and open) balls are convex Is the Discrete Topology on $X$ the Only One Containing All Infinite Subsets of $X$? Prove or find counterexamples.  Let $X$ be an infinite set and $T$ be a topology on $X$. If $T$ contains every infinite subset of $X$, then $T$ is the discrete topology. Double limit of $\cos^{2n}(m! \pi x)$ at rationals and irrationals I stumbled upon this "relation" (is the name correct?):  $$ \lim_{m \to \infty} \lim_{n \to \infty} \cos^{2n}(m! \pi x) = \begin{cases} 1,&amp;x\text{ is rational}\\ 0,&amp;x\text{ is irrational}\end{cases} $$  How is it called and why is it so? I'm really not asking for a proof since I fear it would be too complicated for me to understand, but rather for an "intuition".