chore(i18n,learn): processed translations (#50114)

This commit is contained in:
camperbot
2023-04-20 19:38:02 +05:30
committed by GitHub
parent e5f1a8f73f
commit f0db9433e1
356 changed files with 62759 additions and 209 deletions

View File

@@ -9,23 +9,25 @@ dashedName: generate-random-whole-numbers-with-javascript
# --description--
Es ist großartig, dass wir zufällige Dezimalzahlen generieren können, aber es ist noch nützlicher, wenn wir es nutzen, um zufällige ganze Zahlen zu generieren.
You can generate random decimal numbers with `Math.random()`, but sometimes you need to generate random whole numbers. The following process will give you a random whole number less than `20`:
<ol><li>Verwende <code>Math.random()</code>, um eine zufällige Dezimalzahl zu erzeugen.</li><li>Multipliziere diese zufällige Dezimalzahl mit <code>20</code>.</li><li>Verwende eine andere Funktion, <code>Math.floor()</code>, um die Zahl auf die nächste ganze Zahl abzurunden.</li></ol>
1. Use `Math.random()` to generate a random decimal number.
2. Multiply that random decimal number by `20`.
3. Use `Math.floor()` to round this number down to its nearest whole number.
Denke daran, dass `Math.random()` niemals eine `1` zurückgeben kann und weil wir abrunden, ist es unmöglich, tatsächlich `20` zu erhalten. Diese Technik liefert uns eine ganze Zahl zwischen `0` und `19`.
Remember that `Math.random()` can never quite return a `1`, so it's impossible to actually get `20` since you are rounding down with `Math.floor()`. This process will give you a random whole number in the range from `0` to `19`.
Alles zusammengenommen sieht unser Code folgendermaßen aus:
Putting everything together, this is what your code looks like:
```js
Math.floor(Math.random() * 20);
```
Wir rufen `Math.random()` auf, multiplizieren das Ergebnis mit 20 und übergeben den Wert dann an die Funktion `Math.floor()`, um den Wert auf die nächste ganze Zahl abzurunden.
You are calling `Math.random()`, multiplying the result by 20, then passing the value to `Math.floor()` to round the value down to the nearest whole number.
# --instructions--
Verwende diese Technik, um eine zufällige ganze Zahl zwischen `0` und `9` zu erzeugen und zurückzugeben.
Use this technique to generate and return a random whole number in the range from `0` to `9`.
# --hints--
@@ -47,7 +49,7 @@ Du solltest `Math.random` verwenden, um eine Zufallszahl zu erzeugen.
assert(code.match(/Math.random/g).length >= 1);
```
Du solltest das Ergebnis von `Math.random` mit 10 multiplizieren, damit es eine Zahl zwischen null und neun ergibt.
You should have multiplied the result of `Math.random` by 10 to make it a number in the range from zero to nine.
```js
assert(
@@ -74,9 +76,6 @@ assert(code.match(/Math.floor/g).length >= 1);
```js
function randomWholeNum() {
// Only change code below this line
return Math.random();
}
```

View File

@@ -9,11 +9,11 @@ dashedName: generate-random-whole-numbers-within-a-range
# --description--
Anstatt wie zuvor eine zufällige ganze Zahl zwischen Null und einer bestimmten Zahl zu erzeugen, können wir eine zufällige ganze Zahl erzeugen, die in einen Bereich von zwei bestimmten Zahlen fällt.
You can generate a random whole number in the range from zero to a given number. You can also pick a different lower number for this range.
Dazu legen wir eine Mindestzahl `min` und eine Höchstzahl `max` fest.
You'll call your minimum number `min` and your maximum number `max`.
Hier ist die Formel, die wir verwenden werden. Nimm dir einen Moment Zeit, um ihn zu lesen und zu verstehen, was dieser Code macht:
This formula gives a random whole number in the range from `min` to `max`. Nimm dir einen Moment Zeit, um ihn zu lesen und zu verstehen, was dieser Code macht:
```js
Math.floor(Math.random() * (max - min + 1)) + min
@@ -21,7 +21,7 @@ Math.floor(Math.random() * (max - min + 1)) + min
# --instructions--
Erstelle eine Funktion namens `randomRange`, die einen Bereich `myMin` und `myMax` annimmt und eine zufällige ganze Zahl zurückgibt, die größer oder gleich `myMin` und kleiner oder gleich `myMax` ist.
Create a function called `randomRange` that takes a range `myMin` and `myMax` and returns a random whole number that's greater than or equal to `myMin` and less than or equal to `myMax`.
# --hints--
@@ -87,9 +87,7 @@ for(var i = 0; i < 100; i++) {
```js
function randomRange(myMin, myMax) {
// Only change code below this line
return 0;
// Only change code above this line
}
```