I'm trying to make an array[6] of random numbers (NO REPEATED)  void rnd::process(void){     rndArr[0] = (1+rand()%(45-1));     assign1:     rndArr[1] = (1+rand()%(45-1));     if(rndArr[1]==rndArr[0])goto assign1;     assign2:     rndArr[2] = (1+rand()%(45-1));     if((rndArr[2]==rndArr[1])||(rndArr[2]==rndArr[0]))goto assign2;     assign3:     rndArr[3] = (1+rand()%(45-1));     if((rndArr[3]==rndArr[2])||(rndArr[3]==rndArr[1])||(rndArr[3]==rndArr[0]))goto assign3;     assign4:     rndArr[4] = (1+rand()%(45-1));     if((rndArr[4]==rndArr[3])||(rndArr[4]==rndArr[2])||(rndArr[4]==rndArr[1])||(rndArr[4]==rndArr[0]))goto assign4;     assign5:     rndArr[5] = (1+rand()%(45-1));     if((rndArr[5]==rndArr[4])||(rndArr[5]==rndArr[3])||(rndArr[5]==rndArr[2])||(rndArr[5]==rndArr[1])||(rndArr[5]==rndArr[0]))goto assign5;     }   Can you write a more orthodox code than this?, I'm learning
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?
From  (emphasis mine):     Neutron degeneracy is a stellar application of the Pauli Exclusion Principle, as is electron degeneracy. No two neutrons can occupy identical states, even under the pressure of a collapsing star of several solar masses. For stellar masses less than about 1.44 solar masses (the Chandrasekhar limit), the energy from the gravitational collapse is not sufficient to produce the neutrons of a neutron star, so the collapse is halted by electron degeneracy to form white dwarfs. Above 1.44 solar masses, enough energy is available from the gravitational collapse to force the combination of electrons and protons to form neutrons. As the star contracts further, all the lowest neutron energy levels are filled and the neutrons are forced into higher and higher energy levels, filling the lowest unoccupied energy levels. This creates an effective pressure which prevents further gravitational collapse, forming a neutron star. However, for masses greater than 2 to 3 solar masses, even neutron degeneracy can't prevent further collapse and it continues toward the black hole state.   How then, can they collapse, without violating the Pauli Exclusion Principle? At a certain point does it no longer apply? How should we handle downvote retaliation? Duplicating a mesh object i have a usb wifi adapter Tp-Link model: wn725n  it works very well on windows but i can't find any drivers for linux/ubuntu i tried everything online but nothing work so far  i'm using   Ubuntu 14.04.3 LTS  3.19.0-28-generic  laptop: hp probook 4540s  can you please help me install this adapter? Prove by induction that for all $n \geq 3$: $n^{n+1} > (n+1)^n$ There is an experimental timeline view for questions now available on meta ONLY! (Now working on SO, SF, and SU as well)  This is partially motivated by comments about how difficult it is to follow very active questions which have a lot of activity, and also the feedback on the API which was heavily dominated by "we need to know what happened in this time range" type responses.  It can only be accessed through URL hackery at the moment. To get to it, enter question URLs like so:  https://meta.stackexchange.com/posts/{id}/timeline  This is a chronological timeline of everything that happened on a question, including   initial question ask answers  revisions comments closure, deletion, reopen, undelete, etc votes   all based on when they happened in chronological order.  We are thinking about making this a fourth tab on the question, like so:  Timeline | Oldest | Newest | Votes  Please try it out and provide feedback. It is still a little rough, so we are not looking for highly detailed bug reports, just more general feedback.  Timeline view for this question: Do these leaves signify anything? Unexpected output of xargs The statement below should print afc abc but it prints abc abc instead. I tried many times but every time same result Don't know why this happens could anyone explain and help me?  echo abc|xargs -i{} echo $(echo {}|sed 's/b/f/g') {} Although many have attempted to explain the difference among \mathrm, \textrm, \textnormal and \text (and others?), I found them misleading.  See for example the LaTeX's Wiki \mathrm explanation   Why is it wrong? Let's try all of them within an article and a beamer and you'll see the difference and, therefore, error.  equation.tex  \begin{eqnarray*}   \int_1^9\! \cos{x} \,\mathrm{d}x &amp; &amp; \textrm{this is textrm}\   \sum_1^9 y                       &amp; &amp; \textsf{this is textsf}\   \prod_1^9 z                      &amp; &amp; \textnormal{this is textnormal}\   \bigcup_1^9 w                    &amp; &amp; \text{and this is just text} \end{eqnarray*}   article.tex  \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \input {equation} \end{document}     And until here everything looks fine...  beamer.tex  \documentclass{beamer} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \begin{frame}     \input{equation}   \end{frame} \end{document}     And here we can clearly see that \mathrm does not behave as expected, i.e. does not provide a function aspect to the d. Does anyone know what am I supposed to use here instead? Just \text?? o.O  Moreover, I cannot see any difference between \textnormal and \text.  Finally, \textrm looks useless.. How to boot Ubuntu persistent live USB on Android? I'm discovering the possibilities offered by persistent live USB using Ubuntu 19.10 and I was wondering if it would be possible to boot with Ubuntu on Android (i.e. using your computer capabilities through your smartphone) using those multi-plug USB sticks which have both USB3 and micro-USB2.  In other way: can I get some kind of a boot menu on an Android device in order to boot with a persistent live USB in order to access my Linux computer tools and setup from a wider range of devices? Question. Let $M = \left\{ \begin{bmatrix} a &amp; b \\ -b &amp; a \end{bmatrix} \,\middle\vert\,  a, b \in \mathbb R \right\}$.  Show that $(M,+)$ and $(\mathbb C,+)$ are isomorphic.  Show that $(M^{*},*)$ and $(\mathbb C^{*},*)$ are isomorphic.    (Here, $M^{*}$ is defined as excluding the zero-element) I understand that there exists an isomorphism $\phi:M \rightarrow\mathbb C$ defined by $\begin{bmatrix} \alpha &amp; \beta \\ -\beta &amp; \alpha \end{bmatrix}\mapsto \alpha+i\beta$, ie. I can show that $\phi(M_{1}+M_{2}) = \phi(M_{1})+\phi(M_{2})$ and $\phi(M_{1}*M_{2}) = \phi(M_{1})*\phi(M_{2})$. However, I'm unsure how to go about the two subquestions seperately. I have a Google Apps for your domain account for my domain which we will call DomainA  I have since replaced that domain with DomainB which is set up in the Google Apps account as an alias.   Since I want to let DomainA expire at some point in the future, I would like to change my primary domain to DomainB in my Google Apps account with DomainA as an alias.   How can I do this? Using Virtual Box, how can I install an OS to a secondary, physical disk, and boot it in both (at separate times) Virtual Box, and as a typical secondary OS install? Why is this sentence correct? “She suggested that he go to the cinema.” How can I fix a mistake I made on my income tax filing? [US] How can I fix a mistake I made on my income tax filing? Comparing nullable column values using "IS NULL" versus "= NULL" I'm dealing with nullable values in a column of a table, i'm wondering why this:  with cte as (     select 'c1'::text as c1,null::text as c2     union     select 'c2'::text as c1,null::text as c2 ) select * from cte where c2 is null   returns a result set with the two "rows" having a null value in c2; comparting to this query:  with cte as (     select 'c1'::text as c1,null::text as c2     union     select 'c2'::text as c1,null::text as c2 ) select * from cte where c2 = null   that returns an empty result set!!  so it looks like that field is null is actually different from field = null? the question is... is there "null-compatible operator" to use? so i can write the comparision like: column_name = $1 and argument $1 can be a not null or null value. IF $1 is a null value then it will semantically equals to write as IS NULL, ELSE (if $1 is not a null value) then it would be semantically equals to = $1.  P.D: This question also applies to the case is NOT NULL versus &lt;&gt; NULL The units of $\mathbb Z[\sqrt{2}]$ mysqldump, preserve update_time and modify_time attributes as listed by show table status from Does mysqldump preserve the create_time and update_time attributes that are output by show table status from?  If not, is there an option that does this?   it looks like mysqldump preserves this data if you export to XML. EDIT: Well the data is included in the export. Whether it's read in at the other end I'm not sure.  Is there a way to do this with a normal .sql dump? The exact phrase from the book of Swan (the context is choosing the words permit or allow) -      The passive structure with it is only possible with permit   Having said that...     It is not allowed to smoke in the kitchen - incorrect     It is not permitted to smoke in the kitchen - correct   I feel absolutely fine for the incorrect sentence.   Your inputs please. Make me understand this. How to set up passwordless SSH access for root user I need to configure a machine so software installation can be automated remotely via SSH. Following , I was able to setup SSH keys so my user can access the machine without a password, but I still need to manually enter my password when I use sudo, which obviously an automated process shouldn't have to do.  Although my /etc/ssh/sshd_config has PermitRootLogin yes, I can't seem to be able to log in as root, presumably because it's not a "real" account with a separate password.  How do I configure SSH keys, so a process can remotely log in as root on Ubuntu?