I need a personal ID generator for Bulgarian IDs and since our IDs are 10 digits long I can't do it with an int number and I need some suggestions. I tried with this code but it doesn't work. It also needs to be above 999999999 or below 9999999999.  static class ID {     Random random = new Random();     long perID = random.nextLong(999999999); }
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.
In X-Men Origins: Wolverine,      Wolverine is shot through the head with what appears to be a vibranium bullet by William Stryker. He remarks that the brain will grow back but the memories won't.   So the projectile penetrated the adamantium skull and damaged the brain. Adamantium is an inorganic substance. It will survive anything that would otherwise destroy the rest of Wolverine's body. But if anything (such as vibranium) manages to damage the adamantium, it is not covered by Wolverine's healing abilities.  Does this mean that Wolverine has an Achilles' heel on his forehead? If so, how did he take a bullet to the exact same spot in X-Men: United (at Ice Man's home)? Let $f_n = \mathbb 1_{[-n,n]}$ for all $n \in \mathbb{N}$   Compute explicitly $f_n \star f_1$ for all $n \in \mathbb{N}$.  Show that $f_n \star f_1$ is the Fourier transform of $g_n = \frac{  \sin{(2\pi x)} \sin{(2 \pi nx)}}{\pi ^2 x^2}$  Show that $\| g_n \|_1 \to \infty$  Deduce that the Fourier transform is not surjective from $\mathcal{L}^1(\mathbb{R})$ to $C_0( \mathbb{R})$    Here, $C_0(\mathbb{R})$ is the space of continuous functions $f : \mathbb{R} \to \mathbb{R}$ that tends to $0$ at $-\infty$ and $+\infty$. I managed to compute 1) and proved 2). But I don't know how to prove 3). Moreover, I don't see how can 1), 2) and 3) prove 4). Can anyone help? So I'm at that step where I am finally ready to Render my first big project. Aaaaaand it's been stuck on the first 4 tiles for the last 2 hours?   I am using a MacBook Pro Processor: 2.5 GHz Intel Core i5 Memory: 4 GB 1600 MHz DDR3 Graphics: intel HD Graphics 4000 1024 MB  (I include these because I have no idea what affects a computers ability to render but I assume it's one of them, most liekly the graphics card).  So anyways here are the pictures, as you can see I played with changing the resolution, the sample size and the max steps to see if I got different results but it just keeps getting stuck at those 1st four tiles. I've rendered a few other small projects successfully but this was my first time changing some values. I assume i've managed to accidentally change the wrong values and thats causing some conflict thats either stopping the render itself or is making it just too much for my computer.  My goal was the render this particular picture at a good enough resolution and clarity that it could then be made into a poster. So i wanted the resolution to be good and the sampling to be high.       Since writing this there has been no change to any of the numbers at the top of the render result (the time left, etc) How to find the working folder of a servlet based application in order to load resources Why is homology invariant under deformation retraction/homotopy equivalence? Override parent theme translation on child theme I have a parent theme that uses correctly load_theme_textdomain() to load all the translated strings in many languages.  Then I created a child theme that uses load_child_theme_textdomain() to achieve the same thing for its strings.  There are certain translated strings for a particular language on the parent theme that I'd like to replace/override in the child theme.  I know if they were on a template file I could replace the file and simply change the textdomain for those strings, but unfortunately the ones I'm talking about are used in many places and also in the dashboard (so inside some filter/action functions).  So my question is: is there a way to replace those translated strings inside the child theme without having to replace parent template files or functions?  I don't know, maybe adding a parent-theme.mo file inside the languages folder of the child theme with only those strings translated, or something like that. C# datetime parse issue Debate, Bare Plurals, and Mass Nouns What is known about $\mathcal C^\infty$ functions $\mathbb R\to\mathbb R$ that always take rationals to rationals? Are they all quotients of polynomials? If not, are there any that are bounded yet don't tend to a limit for $x\to +\infty$? If there are, then can we also require them to be analytic?  (This is basically just a random musing after I found myself using trigonometric functions twice in unrelated throwaway counterexamples. It struck me that it was kind of conceptual overkill to whip out a transcendental function for the purpose I needed: basically that it had to keep wiggling forever. I couldn't think of a nice non-trancendental function to do this job, however, and now wonder whether that is because they can't exist). I'm trying to make a command that creates a book that has many items with enchantments at level 1,000. However, I don't know why it keeps saying:     Data tag parsing failed: Unbalanced quotation:   {ench:[{id:0,lvl:1000}],Unbreakable:1,display:{Name:"Prot   It's supposed to say "Protection Armor", but it only shows "Prot" for some reason. This is the same with all of my other items. Here is the one part of the command that I've showed you:  {ench:[{id:0,lvl:1000}],Unbreakable:1,display:{Name:"Protection Armor"}} Does a Magic Staff count as a magic weapon? Many creatures have resistance to weapons that aren't "magic weapons".  A Magic Staff can be used as a quarterstaff, but (usually) doesn't have a bonus to hit (a "plus").  Is it considered a Magic Weapon for the purpose of damage resistance? PDF of product of variables Could anyone please indicate a general strategy (if there is any) to get the PDF (or CDF) of the  product of two random variables, each having known distributions and limits?   My particular need is the following: Let $w :=u \cdot v$. The PDF of $u$ is $$\frac{1}{\pi u}\frac{1}{\sqrt{u^2-0.25}},$$ for $z&gt;0.5$ and the PDF of $v$ is $$\exp\left(-\frac{v}{v_0}\right),$$ for $v_1&lt;v&lt;v_2$. What's the PDF of $w$? Expected Value of a Hypergeometric Random Variable Using Sequence to delete a part of an expression What is the physical explanation for energy transport in simple electrical circuits? Keeping it simple, what is the physics approach to a current in a wire connected to a battery? How does the electric field behave?  I've read somewhere that, contrary to the common conception, electrons don't really flow as water in a hose so, what is really going on there? How is energy transported at the speed of light if electrons don't flow like very fast water? I have a Sony VAIO S series with Windows 8 preinstalled, and I installed Ubuntu 12.10 on a new partition. When the PC boots Grub is display, and I can choose between Windows 8 (didn't worked at the beginning, had to change Grub settings) and Ubuntu 12.10. When I select Ubuntu 12.10 everything is OK, but when I use Windows 8, and I restart Grub isn't displayed anymore (Windows 8 boots immediately).  I booted a Ubuntu 12.10 LiveUSB, used efibootmgr, and found out that Windows 8 (each time it boots) changes EFI default bootloader from Grub to Windows Boot Manager.  How do I change this in Windows 8? I read something about bcdedit, but it does not work or I don't know how to use it... Is the complement of a prime ideal closed under both addition and multiplication? Missing files (basic sty files) when TEXINPUTS is set Below is my files tree:  .../Doc/Tex/book.tex .../Doc/Tex/images/im.jpg .../Doc/TexBase/myTemplate.sty .../Doc/TexBase/baseImages/logo.jpg   On Windows it was enough to set TEXINPUTS evironment variable with some paths and then I was able to compile with:  pdflatex Tex/book.tex   my document book.tex which uses package myTemplate.sty And now im trying to do teh same on Ubuntu 18.04. When i move all things to one folder (book.tex and myTemplate.sty and folder with images) then compilation is succesfull. But i would like to keep my foder structure as it is more clearly. So i tried to export TEXINPUTS:  export TEXTINPUTS=.:./TexBase/   but my compilation fail because of unfound many sty-files wchich are part of texlive-latex-extra that i already installed. When i UNSET this variable - it compiles ok. So my question is: Am i correctly set TEXINPUTS variable? Maybe i should add some other paths? What is the path to those "latex basic STY files"? Text alignment issue in custom Table of Contents As you can see from the image below, I have an issue with the text alignment of extra long chapter names. How can I fix it so that the text will not go further left than the start of the chapter name? That is, I don't want any text to be underneath the "Appendix A" part.  I added that red line just to show how I'd like it aligned, if possible.    Here's my MWE:  \documentclass{book} \let\cleardoublepage\clearpage  \RequirePackage{titletoc} \RequirePackage{tikz} \RequirePackage[explicit]{titlesec} \RequirePackage{DejaVuSansCondensed} \RequirePackage[normalem]{ulem} \RequirePackage[   left=2.25in,   right=0.75in,   top=1.25in,   bottom=1.25in,   marginparwidth=1.75in,   marginparsep=.25in,   asymmetric]{geometry}  \renewcommand*\familydefault{\sfdefault} % Set default font  %%% Table of Contents ---------------------------------------------------------- \setcounter{tocdepth}{1} % Show only Chapters and Sections  %%% Change font/color/layout of TOC \makeatletter \titlecontents{chapter}[-2em] {\color{cyan}\bfseries\LARGE\addvspace{3mm}} {\makebox[4.4em][r]{\@chapapp}\contentslabel{-0.25em}\hspace{1.9em}} {} {\hspace{3em}\contentspage} \g@addto@macro{\appendix}{%   \addtocontents{toc}{\protect\renewcommand*{\protect\@chapapp}{\protect\appendixname}}% } \makeatother  \titlecontents{section}[5.3em] {\color{cyan}\large\itshape\addvspace{3mm}} {\contentslabel{0em}\hspace{3.2em}} {} {\hspace{3em}\contentspage} [\addvspace{0mm}]  %%% Chapter Header ---------------------------------------------------------- \makeatletter \titleformat{\chapter}   {\normalfont\sffamily\Huge\scshape}   {}{0pt}   {\thispagestyle{empty}    % Remove page number on new chapters   %\setcounter{definition}{0}   \begin{tikzpicture}[remember picture,overlay]     \node[yshift=-3cm] at (current page.north west)       {\begin{tikzpicture}[remember picture, overlay]         \draw[fill=cyan] (0,-1) rectangle           (25cm,3cm);         \draw[fill=cyan] (0,-24) rectangle           (25cm,-25cm);         \ifttl@label% &lt;---------------------- Added condition on \ifttl@label           \node[anchor=west,xshift=.21\paperwidth,yshift=-.01\paperheight,rectangle]               {\color{white}\LARGE \MakeUppercase{\@chapapp} \Huge\thechapter};         \fi% &lt;------------------------------- end condition on \ifttl@label        \end{tikzpicture}       };    \end{tikzpicture}\endgraf   \vskip-.7cm   \color{cyan}\Huge\raggedright\leftskip-1cm    \noindent\MakeUppercase{#1}\endgraf   } \makeatother  \titlespacing*{\chapter}{0pt}{10pt}{0pt}{}  \titleformat{\section}{\color{cyan}\itshape\LARGE}{\llap{\thesection} #1}{1em}{}[\titleline{\color{cyan}\titlerule[1pt]}] \titleformat{\subsection}{\color{cyan}\normalfont\large}{\; #1}{1em}{}  \begin{document}   \tableofcontents   \chapter{Turing Machines}     \section{The Turing Machine}     \section{Variations of the Turing Machine}       %\subsection{Non-deterministic Turing Machines}     \section{The Church-Turing Thesis}   \chapter{Decidability}     \section{The Universal Turing Machine}    \appendix   \chapter{ON COMPUTABLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHEIDUNGSPROBLEM} \end{document} How does Mathematica integrate?