I need to create two different dice in Java. The first one (dice1) has random integer values from 1 to 10 inclusive. The second dice (dice2) should have even numbers from 2 to 20 inclusive. I was able to successfully code for dice1 but cannot figure out how to declare and initialize dice2. Below is the code I wrote for dice1. How would I go about coding for dice 2? int dice1 = (int)Math.floor(Math.random()*(10-1+1)+1);
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.
I'm using pdfLatex (with --shell-escape option) and I had a problem of compilation with TexWorks that was successfully solved with the help of other post in this site: .  After correcting that error the code compiles smoothly but just displays the logarithmic grids, not the function. The gnuplot files are created in the right place, but the graphic doesn't come out in the PDF.  Code from :  \documentclass{article}  \usepackage{tikz} \usepackage{bodegraph}  \begin{document}  \begin{tikzpicture}[     gnuplot def/.append style={prefix={}}, % Fixed the issue (prefix was 'gnuplot/\jobname/' before) ] \begin{scope} \UnitedB \semilog{-1}{2}{-50}{60}  \BodeAmp{-1:1.35}{\POAmpAsymp{4}{2.0}+\IntAmp{1}}  \end{scope} \end{tikzpicture} \end{document}   Any clues? How many solutions has the equation $\sin x= \frac{x}{100}$ ? How many solutions has the equation $\sin x= \frac{x}{100}$ ?   Usually when I was asked to solve this type of problem, I would solve it graphically but this one seems to be trickier. It doesn't seem wise to put $f(x)=\sin x$ and $g(x)=\frac{x}{100}$ in the same graph and then counting all the intersection points.  What would be some algebraic methods to solve this? Stack Overflow in ES, PT, RU, JP have mixed-language descriptions Does Find My Mac stop working after the system has been wiped? For example:  "Last week, I found out that NASA stands for 'National Aeronautics and Space Administration.'"  or  "Last week, I found out that NASA stood for 'National Aeronautics and Space Administration.'" How can I find unanswered questions with zero answers in some tag? In  (ignoring Hawking radiation), why is a  black? Why nothing, not even light, can escape from inside a black hole? To make the question simpler, say, why is a  black hole black? $\sum \cos$ when angles are in arithmetic progression What is a word that could define someone who likes to cause conflict? What would you call someone who does things knowing specifically that his/her actions will cause pain and/or conflict or completes an action just to get someone in trouble or hurt them?   For example, in  there are two people that are in love, but the Colonel goes out of his way to tell the father of the girl that the boy is a thief and would be bad for their reputation.   What is a word that would describe him? When do "well" and "good" mean the same? Proving the summation formula using induction: $\sum_{k=1}^n \frac{1}{k(k+1)} = 1-\frac{1}{n+1}$ I am trying to prove the summation formula using induction:  $$\sum_{k=1}^n \frac{1}{k(k+1)} = 1-\frac{1}{n+1}$$  So far I have...  Base case:   Let n=1 and test   $\frac{1}{k(k+1)} = 1-\frac{1}{n+1}$  $\frac{1}{1(1+1)} = 1-\frac{1}{1+1}$    $\frac{1}{2} = \frac{1}{2}$   True for n=1   Induction Hypothesis:   Assume the statement is true for the n-th case   $\sum_{k=1}^n  \frac{1}{k(k+1)} = 1-\frac{1}{n+1}$  Inductive Step:   Prove, using the Inductive Hypothesis as a premise, that   $$\sum_{k=1}^{n+1}  \frac{1}{k(k+1)} = \sum_{k=1}^{n}  \frac{1}{k(k+1)} + \frac{1}{(n+1)(n+2)} = 1-\frac1{n+1} + \frac{1}{(n+1)(n+2)} = \frac{(n+1)(n+2)}{(n+1)(n+2)}+\frac{-2-n}{(n+1)(n+2)}+\frac{1}{(n+1)(n+2)} = \frac{(n+1)(n+2)-2-n+1)}{(n+1)(n+2)} = \frac{(n+1)(n+2)-n-1}{(n+1)(n+2)} = \frac{n^2+2n+1}{(n+1)(n+2)} = \frac{(n+1)(n+1)}{(n+1)(n+2)} = \frac{n+1}{n+2}$$  To prove $$ 1-\frac{1}{n+2} = \frac{n+1}{n+2} $$ Multiply both sides by $n+2$ to get an equivalent expression. $$ (1-\frac{1}{n+2}) * (n+2) = (\frac{n+1}{n+2}) * (n+2)  $$ $$ n+1=n+2−1 $$  Does this all make sense? How can this be improved upon? $\mathbb{Q}(\sqrt{n}) \cong \mathbb{Q}(\sqrt{m})$ iff $n=m$ Page 105 of D. Burton's A First Course in Rings and Ideals reads     It is not difficult to show that if (I'll call them $n$ and $m$ instead of $n_1$ and $n_2$) $n$, $m$ are square free integers, then $\mathbb{Q}(\sqrt{n}) \cong \mathbb{Q}(\sqrt{m})$ if and only if $n=m$.   Well, it is getting difficult for me, any help or would be appreciated.    My progress so far: Suppose $\phi :\mathbb{Q}(\sqrt{n})\to\mathbb{Q}(\sqrt{m})$ is an isomorphism. Then $\phi(u)=u$ for every $u \in \mathbb{Q}$, so that $\phi(\sqrt{n})^2=\phi(n)=n$. If $\phi(\sqrt{n})=a+b\sqrt{m}$ for some $a,b\in\mathbb{Q}$, then $(a+b\sqrt{m})^2=a^2+b^2m + 2ab\sqrt{m}=n$ implies $$a^2+b^2m = n$$ and $$2ab=0.$$  Then $b=0$ cannot happen since that would imply that $\sqrt{n}\in\mathbb{Q}$, where $n$ is a square-free integer. Also $a=b=0$ cannot happen. Hence $a=0$ and we have $$b^2m=n.$$ If $\psi:\mathbb{Q}(\sqrt{n})\to\mathbb{Q}(\sqrt{m})$ were an isomorphism then there would exist some $s\in\mathbb{Q}$ such that $$s^2m=n,$$ then $s=b$ or $s=-b$. Therefore the only isomorphisms from $\mathbb{Q}(\sqrt{n})$ to $\mathbb{Q}(\sqrt{n})$ are $\phi(u+v\sqrt{n})=u+vs\sqrt{m}$ and $\psi(u+v\sqrt{n})=u-vs\sqrt{m}$.    I don't know if there's an easier way and I don't know if I'm in the correct way here. Thanks beforehand :) How to connect to Office Online Server in Office365 I just wondering if we can use existing Office Online Server in Office365 for SP2013 on premise. If yes, how this can be achieve?   In SP2013 we normally run Get-SPWOPIBinding to find out the server binding and to connect to Office web App we normally run  New-SPWOPIBinding -ServerName. Is this the same command if I want to connect to the existing new Office Online Server in Office365?  Thanks What is the relationship between ISO, aperture, and shutter speed? I know digital cameras have ISO options, and that ISO is the camera's sensitivity to light, but if you set  higher ISO then you can get a noisy image. I also know there are two other camera options, shutter speed and aperture.   What is the relationship of between them? Is there any equation, or something like that?  For example, if I set the ISO to 640, then how should I set the shutter speed and aperture? Assume a table structure of MyTable(KEY, datafield1, datafield2...).  Often I want to either update an existing record, or insert a new record if it doesn't exist.  Essentially:  IF (key exists)   run update command ELSE   run insert command   What's the best performing way to write this? Blender python custom UI button run custom function? When it's OK to omit "where?" Is it possible to plot a graph of any shape? What immigration and customs checks are performed for passengers leaving the U.S.? Remove OTA downloaded (but not installed) iOS 8 I've downloaded the new iOS 8 update on my iPhone 5 but am getting second thoughts about actually installing it.  Is there a way for me to delete that download or am I at the point of no return?