So what I have so far is a randomized board containing numbers 1, 2 and 3. The board is 6 * 10. (So 6 Columns and 10 rows). The plan is when the user gives an input, a new row of randomized numbers should be added to the board. The thing is that the 2D array will be 6 *

# Tag: math

## How to generate a random number in Java between x and y where the mean is m? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago. Improve this question I need to generate random numbers between 100 and 500 where the mean is 150. I’ve been reading on distribution

## Algorithm to get the submultiples of each number in a range

I have this exercise in mind, I keep trying to solve it in Java but I’m not able to create a correct algorithm to get the submultiples of each number in a range, the start and the end of the range is user defined. Besides, the number 1 doesn’t count as a submultiple. For example, in a range between 3

## Java Calculator program issue

I am trying to develop a calculator program that inputs an arithmetic expression of the form number operator number = and computes the result of the expression. The expression will be evaluated from left to right not considering regular operator precedence. For example, the expression 14 – 5 * 3 = will produce 27.0. The value = displays the final

## Level calculation

somehow I can’t think of a solution to a problem that is actually quite easy. It’s about a level system where I need a kind of formula that is very simple but I can’t think of it. I calculate the level from the experience points and there you need e.g. for level 1 1.000 EXP, for level 2 3.000 EXP,

## How to restore initial fraction from a big decimal

I have a list of fractions that have to be converted to a bigDecimal first and then converted to a fraction again. I have made two methods: first converts from fraction to bigDecimal and the second does the opposite. However, I have noticed that during the conversion I am losing on some precision, hence I was wondering if there is

## Longest common prefix in binary representation

We are given a undirected tree with N (1 to N) nodes rooted at node 1. Every node has a value assigned with it, represented by array – A[i] where i:[1:N]. We need to answer Q queries of type : -> V X : longest length of the common prefix between value V and any ancestor of node X including

## How to calculate which sector of a circle a given point is with custom sectors?

So I’m making a TD game where I can place a gatling gun, and depending on which sector of a surrounding circle the mouse is in, the sprite and bullet path will change. My difficulty is with creating an algorithm which will tell me which sector my mouse is in. My circle has 16 sectors, and a radius of 300.

## Put sin on segment in 3d

i need to put a sin function, or any other function on start of segment in 3d space. Something like that: Example But in 3d space, help me pls, i spent about 4 days for solving it, but did not get result There are 2 points in space at arbitrary positions. I need a sinusoid between these two arbitrary points.

## How to compute approximate natural log of 2 n times in java?

The instructions were: 1. Compute the ln of 2, by adding up to n terms in the series. a) You can approximate the natural logarithm of 2 with a series. The more terms you use, the closer you get to the natural logarithm of 2. b) ln 2 = 1 – 1/2 + 1/3 – 1/4 + 1/5 – …