What is the easiest way to include 1 using Math.random function?  Since the default is number between inclusive 1 and exclusive 0.  I am going to use my the rand function a lot of times in my code that is why i need an even probability of getting numbers between 0 and 1 [0,1] , inclusive 0 and inclusive 1.  Thanks!   Edit:  Sorry, big mistake. Exclusive 1, inclusive 0.
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.
How to launch terminal on login How could I get the terminal to be launched once I have logged in, so that typing commands is much simpler? Suppose that $f$ is differentiable on $\mathbb{R}$ and $\lim_{x\to \infty}f'(x)=M$. Show that $\lim_{x\to \infty}f(x+1)-f(x)$ exists and find it. I've been stuck on this question for a long time now and was wondering if anyone could show me how it's done. So far I have done the following: Since $\lim_{x\to \infty}f'(x)=M$ then $\forall \epsilon ,\exists A &gt;0$  s.t. if $x&gt;A$ then $|f'(x)-M|&lt;\epsilon$. So we have that $M-\epsilon&lt;f'(x)&lt;M+\epsilon$. By MVT on $[x,x+1]$ for $x&gt;A$, $\exists c\in (x,x+1)$ s.t. ${f(x+1)-f(x)\over 1}=f'(c)$. Therefore, $M-\epsilon&lt;f(x+1)-f(x)&lt;M+\epsilon$. However, I do not know what to do after this. GroupBy a list of associations with their keys Obviously, you can use the | (pipe?) to represent OR, but is there a way to represent AND as well?  Specifically, I'd like to match paragraphs of text that contain ALL of a certain phrase, but in no particular order. How to fix slow wireless on machines with Intel wireless cards? I have looked through all the previous questions but turning power management off for the Wi-Fi card didn't work. This problem seems to be with the Lenovo Thinkpads. I switched to Ubuntu 11.10 from Windows 7 3 days ago so I'm new to the operating system. What harm can be done with a copy of one's passport? E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) I'm trying to run this command in the terminal:  sudo apt install software-properties-common   This is the error message I get:  E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)   E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend),     is another process using it? Is it possible to host a web server from behind a NAT My PC is behind a NAT router that has a public IP address. If I want to host a website then I believe I need a domain name which I can purchase from some site which would pledge to resolve all DNS requests for that domain name and send the IP address of my NAT router (assuming I do not want to host my domain name on their servers). Now I want to host a web server on my computer.   What changes should be done to the NAT router's configuration to forward all HTTP requests for example.com to my PC in the internal network. Is the above strategy correct? Is it commonly used? Is every metric space a subspace of some connected metric space? I think it would be cool if a question would eventually open up to moderators to accept answers on the user's behalf, once a time period has passed. The asking user would get the rep score for the accept.  I know I've seen questions successfully answered with lots of upvotes and no accepted answer that sit there for months unaccepted. This would give superusers a little more functionality and would tie up a lot of loose ends.  What do you think? Perturbation property of Orthonormal basis for Hilbert space Get number of frames in scene from the command line? I'd like to know if there is a command-line option (or combination, or a way!) to get the number of frames that are included in a specified blender scene; for example I'd like to use is like this:  $ blender &lt;option&gt; file.blend $ Number of frames in blender scene: xxxx Here's a question I've been asked;  Given distinct primes $p,q,r$, show that any group $G$ of order $pqr$ is not simple.   So far, my idea has been to individually check each possible proper subgroup, since by Lagrange there are only $$\dbinom{3}{2} + \dbinom{3}{1} + 1$$ of them, and show that at least one of them other than the trivial group is normal. Surely there is a smarter way, since generalizing this approach wouldn't work so well if I wanted to show similar results for groups who's order is a product of $n$ distinct primes.  Is there some other approach? Thanks for any insights percent signs in luacode* environment (LuaLaTeX) Can someone explain what happens here:  \documentclass{article} \usepackage{luacode} \begin{document}  \begin{luacode*} tex.print("xx\%a","yy\\%b","zz\\\%c") \end{luacode*}  \end{document}   The result is xxyy%b zz%c. (The xx,yy,zz is clear.) The \%a is "ignored", the \\%b and the \\\%c results in the "same" %b (or c). What is the preferred way to get a % in the PDF output? Why is the \%a ignored? What does TeX see after returning from the lua call? I want to assign a class attribute via a string object - but how?  Example:  class test(object):   pass  a = test() test.value = 5 a.value # -&gt; 5 test.__dict__['value'] # -&gt; 5  # BUT: attr_name = 'next_value'  test.__dict__[attr_name] = 10 # -&gt; 'dictproxy' object does not support item assignment Why did the limit of power change from wizard/witch to wand? So in the first 5 or 6 books, it was very clear that the wand chooses the wizard and the power/level of the spells the wizard produces is based on the knowledge and skill of the wizard.  This is referenced by people constantly being telling Harry that he wasn't skilled enough to perform certain spells, or Bellatrix telling Harry that he needed to mean the Cruciatus curse for it to be effective.  However, in the 7th book, this entire idea is changed to the wand being the thing that's powerful and regardless of the wizard's/witch's skill or knowledge, he/she could still perform a very advanced spell if it's something the wand could handle.  Goyle accidentally creating a fire serpent is something that instantly comes to mind from the movies(I don't remember if that happened in the book).  So, my question is, what actually holds the power, the wizard/witch, or the wand? Bonferroni adjustment in SPSS - what does it do? I'm probably being a bit simplistic here, but from what I understand the Bonferroni post hoc test is simply when we adjust the alpha to account for inflated error when several post hoc tests are conducted. You divide the alpha by number of tests. So what exactly does SPSS do when we click the button for Bonferroni?   Shouldn't the dividing of alpha be done by us in interpreting the result, e.g. if we do 10 post hoc tests our alpha criterion should be .005 so if the p value is .012 then it is not significant, but SPSS hasn't done anything there, we have just changed our interpretation. So what exactly is it adjusting? Universe being flat and why we can't see or access the space "behind" our universe plane? I'm a layman, but i watched some intereting videos about big bang on youtube[michio kaku, hawking this kind of things, not some crackpots :)]   I described everything on my picture:     So is there any possibility to see that inner side, for example, by creating wormhole, or entering new dimension? Or i get something wrong, on the way, and my model is totally wrong?  And another question. I heard that even if you would fly a ship across the universe you would eventually end in the place where you started, because we live in a 3d space that is defined on a surface of big sphere. But why a big sphere? Universe might be a big mobius strip, and the same principle of ending at start will apply. Is it possible?  Thanks in advance, and please don't bash me for silly questions. Im just curious, but i don't have any degree in physics. Im also not an english native speaker. Converting expressions to polynomial form When are stopovers permitted on Japan Railways (JR) trains?