Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 063818f

Browse files
committed
Refactor number formatting and rounding in article.md
1 parent efe8f38 commit 063818f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

‎1-js/05-data-types/02-number/8-random-min-max/solution.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
We need to "map" all values from the interval 0..1 into values from `min` to `max`.
1+
เราต้องการ "แมป" ค่าทั้งหมดจากช่วง 0..1 ไปเป็นค่าจาก `min` ถึง `max`
22

3-
That can be done in two stages:
3+
สามารถทําได้ใน 2 ขั้นตอน:
44

5-
1. If we multiply a random number from 0..1 by `max-min`, then the interval of possible values increases `0..1` to `0..max-min`.
6-
2. Now if we add `min`, the possible interval becomes from `min` to `max`.
5+
1. ถ้าเราคูณตัวเลขสุ่มจาก 0..1 ด้วย `max-min` ช่วงของค่าที่เป็นไปได้จะขยายจาก `0..1` เป็น `0..max-min`
6+
2. จากนั้นถ้าเราบวก `min` ช่วงที่เป็นไปได้จะกลายเป็นจาก `min` ถึง `max`
77

8-
The function:
8+
ฟังก์ชัน:
99

1010
```js run
1111
function random(min, max) {

‎1-js/05-data-types/02-number/8-random-min-max/task.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ importance: 2
22

33
---
44

5-
# A random number from min to max
5+
# สุ่มตัวเลขจาก min ถึง max
66

7-
The built-in function `Math.random()` creates a random value from `0` to `1` (not including `1`).
7+
ฟังก์ชันในตัว `Math.random()` สร้างค่าสุ่มจาก `0` ถึง `1` (ไม่รวม `1`)
88

9-
Write the function `random(min, max)` to generate a random floating-point number from `min` to `max` (not including `max`).
9+
เขียนฟังก์ชัน `random(min, max)` เพื่อสร้างตัวเลขทศนิยมแบบสุ่มจาก `min` ถึง `max` (ไม่รวม `max`)
1010

11-
Examples of its work:
11+
ตัวอย่างการทํางาน:
1212

1313
```js
1414
alert( random(1, 5) ); // 1.2345623452

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /