How can I generate random numbers between 0 and a user input number? I'm pretty new to Java and this website, and I'm sorry if this question has already been asked  but if it isn't to hard, an answer would be extremely helpful.
How do I generate random integers within a specific range in Java? How do I generate a random int value in a specific range? I have tried the following, but those do not work: Attempt 1: randomNum = minimum + (int)(Math.random() * maximum);  Bug: randomNum can be bigger than maximum. Attempt 2: Random rn = new Random(); int n = maximum - minimum + 1; int i = rn.nextInt() % n; randomNum =  minimum + i;  Bug: randomNum can be smaller than minimum.
number of ways to make $2.00 Can I use a one time pad key twice with random plaintext? Trying to find a story about an unborn telepathic baby who can save a spaceship from doom Physical Explanation for "Kolmogorov -5/3 spectrum" in Fluid Mechanics According to Kolmogorov, the energy spectrum function of a turbulent fluid is given as,  $E(k)=C\epsilon^{\frac{2}{3}}k^{\frac{-5}{3}}$  where $\epsilon$ is the energy flux and $k=\frac{2\pi}{r}$ where $r$ is the length scale.   The normal explanation I see in most physics texts and articles is that the -5/3 exponent is found purely through dimensional analysis. Obviously dimensional analysis is very useful, but often times there is a more physical explanation as well. Does anyone have any insights? I want to package my project in a single executable JAR for distribution.  How can I make a Maven project package all dependency JARs into my output JAR? Start a new process without blocking the terminal Is it possible to do this? For example if I run "gedit tifatul.txt" via the command line, my terminal becomes blocked and I can't enter other command in this terminal before I quit gedit. Can I start a program (like gedit) without blocking the terminal? In windows I think this can be done like "start notepad tifatul.txt" How do I fix a boolean/bisected surface edge? I am trying to slice up my models using the Boolean modifier.  After applying the modifier on my smooth mesh, I get the expected result, a flat dissection to separate my mesh into two.  The problem lies in how I can resolve the visual "jaggered" edge that separates my (smooth) mesh exterior from the flat dissection face.    Is it possible to achieve a smooth-to-flat variation without this artifact?   I tried to alter a mixture of the two but end up with artifacts, or unwanted blocky flat mesh faces around the dissection edge of my mesh. Mysterious cord running from wall. Safe? My wife and I are preparing to sell our home and are discovering some weird things. Our home was built in 1958, so it is older. We found this in a corner that had some furniture in front of it.   We are wondering    What kind of wiring is this?  Is it safe to handle or remove? Scattering, Perturbation and asymptotic states in LSZ reduction formula I was following Schwarz's book on quantum field theory. There he defines the asymptotic momentum eigenstates $|i\rangle\equiv |k_1 k_2\rangle$ and $|f\rangle\equiv |k_3 k_4\rangle$ in the S-matrix element $\langle f|S|i\rangle$ as the eigenstates of the full Hamiltonian i.e., $H=H_0+H_{int}$. Therefore, the states $|i\rangle=|k_1 k_2\rangle$ is defined as $$|k_1 k_2\rangle=a_{k_1}^{\dagger}(-\infty) a_{k_2}^{\dagger}(-\infty)|\Omega\rangle$$ where $|\Omega\rangle$ is the vacuum of the full interacting theory. Then the LSZ reduction formula connects the S-matrix element $\langle f|S|i\rangle$ to the Green' functions of the interaction theory defined as $$G^{(n)}(x_1,x_2,...x_n)=\langle \Omega|T[\phi(x_1)\phi(x_2)...\phi(x_n)]|\Omega\rangle.$$ Here are a few doubts. Doubt 1 When the particles are far away, the interaction can be considered to be adiabatically switched off. Therefore, at $t=\pm\infty$ the states are really free particle states and should have been written as $$|k_1 k_2\rangle=a_{k_1}^{\dagger}(-\infty) a_{k_2}^{\dagger}(-\infty)|0\rangle$$ and $$|k_3 k_4\rangle=a_{k_3}^{\dagger}(+\infty) a_{k_4}^{\dagger}(+\infty)|0\rangle$$ where $|0\rangle$ is the vacuum of the free theory.  I do not understand why these the states $|i\rangle$ and $|f\rangle$ are derived from $|\Omega\rangle$ instead of $|0\rangle$. Doubt 2 The initial and final states were derived from the vacuum of the interacting theory $|\Omega\rangle$. According to my understanding, this suggests that the states $|i\rangle\equiv |k_1 k_2\rangle$ and $|f\rangle\equiv |k_3 k_4\rangle$  are eigenstates of the full Hamiltonian $H$. Since then there is no perturbation, there should not be any scattering or transition at all.  More references Even Peskin &amp; Schroeder, Bjorken &amp; Drell, Srednicki take the same approach as Schwartz; they too define the external momentum eigenstates to the eigenstate of the full Hamiltonian $H$. However, if the system was initially in a stationary state why should it undergo a transition in absence of any perturbation? Clean URLs and php extension on nginx I've looked at dozens of other questions and references on the web - and by all my calculations, my setup should work, but it doesn't.  I have nginx installation with php-fpm.  If I try to access a .php file, it runs correctly and I get the correct results.  I got this in my config file:  location ~ \.php$ {     try_files $uri =404;     fastcgi_pass unix:/var/run/php5-fpm.sock;     include fastcgi_params;     fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name; }   Now, I want to setup my web app so that /somedir/file automatically executes /somdir/file.php while still displaying /somdir/file in the browser's address bar.  So I modified my config to contain the following:  location / {     try_files $uri $uri/ $uri.php?query_string }   This kind of works, that is, the server does access the .php file.  Yet, instead of executing it using the existing location ~ \.php$ block above, it simply spits the php source code as the download into the browser.  If I append the .php manually to the requested URL, then the php is executed.  It feels as if once the server matches try_files to $uri.php, it then does not do another pass at locations to see that what it needs to do with the php files.  I tried putting the php block above and below the location /, but it makes no difference.  How can I get the php to be executed? Moving Grub to a new drive to get rid of Windows Solidify conundrum? I stumbled across a solidify issue, I cannot wrap my head around. I have a simple mesh, consisting of three faces.  When adding a solidify modifier, I expect to get an object with three walls, where every angle is square. However, whatever I try, tweaking the various solidify parameters, what I get is something like the following, with a skewed rim.  Did I hit a bug, or is it a limitation of the solidify modifier? Is there a workaround? Hubble's constant $a(t)$ appears to be changing over time. The fine stucture constant $\alpha$, like many others in QFT, is a running constant that varies, proportional to energy being used to measure it. Therefore, it could be agued that all running constants have 'evolved' over time as the Universe has expanded and cooled. Both the local and global curvature of the Universe changes over time implying that so too does the numerical value of $\pi$. All these things are however constants (well, let's say parameters since they are not really 'constant'.)   In  with astronomer Sir Fred Hoyle, Feynman said "what today, do we not consider to be part of physics, that may ultimately become part of physics?" He then goes on to say "..it's interesting that in many other sciences there's a historical question, like in geology - the question how did the Earth evolve into the present condition? In biology - how did the various species evolve to get to be the way they are? But the one field that hasn't admitted any evolutionary question - is physics."  So have the laws of physics remained form-invariant over the liftetime of the Universe? Does the recent understanding of the aforementioned not-so-constant constants somehow filter into the actual form of the equations being used? Has advances in astronomical observations, enabling us to peer back in time as far back as the CMB, given us any evidence to suggest that the laws of nature have evolved? If Feynman thinks that "It might turn out that they're not the same all the time and that there is a historical, evolutionary question." then this is surely a question worth asking.  NB/ To be clear: this is a question concerning purely physics, whether the equations therein change as the Universe ages, and whether there is any observational evidence for this. It is not intended as an oportunity for a philosophical discussion. Evaluating even binomial coefficients Can someone give me a hint how to evaluate $$ \binom{n}{0}+\binom{n}{2}+\cdots+\binom{n}{o(n)},$$ where $o(n)$ is $n$ if $n$ is even and $n-1$ otherwise ? How to add current date to cell if the rest of the cells (or some cells) in that row are edited, but only the first time? Ubuntu kernel not upgrading with upgrade to 15.10 Why cannot a set be its own element? Random string that matches a regexp I know that the rotation period of the moon equals its revolution period. It's just so astonishing that these 2 values have such a small difference. I mean, what is the probability of these 2 values to be practically the same? I don't believe this to be a coincidence. It's just too much for a coincidence. What could have caused this? selectively make contact groups silent At work , i would prefer to set my phone in such a way that only the calls from my family group will ring , while all other contact calls should be silent. And later i should be able to switch it back to normal.  In general , there are sound profiles for phones, but the profiles are not specific to a contact or a group, i need a work profile which will set Family - Normal Others - Silent . etc  Is there any app in the market that would help me with this??