Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard random API #1988

Merged
merged 3 commits into from
May 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/example-frontend-js/src/ExampleMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.w3c.dom.*
import kotlin.browser.*
import kotlin.coroutines.*
import kotlin.math.*
import kotlin.random.Random

fun main() {
println("Starting example application...")
Expand All @@ -35,8 +36,7 @@ private fun HTMLElement.setPosition(x: Double, y: Double) {
}
}

@Suppress("DEPRECATION")
private fun random() = kotlin.js.Math.random()
private fun random():Double = Random.nextDouble()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One empty line should also be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one? I don't add empty lines :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. My bad. Disregard.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I somehow thought I've removed the function completely. Actually, there's now no much sense in having this function in the first place -- it would be better if it is just inlined to all its use-sites.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inlined


class Application : CoroutineScope {
private val body get() = document.body!!
Expand Down