Skip to content

Using expression containing Math.random() more than once wrongly assumes all instances should have same result #15096

@parallaxshiftdj

Description

@parallaxshiftdj

Describe the bug

An expression is used here twice, but because it contains Math.random() it shouldn't be assumed that the same result will occur every time it is used.

Reproduction

v5.19.0 (Desired outcome)
https://svelte.dev/playground/hello-world?version=5.19.0#H4sIAAAAAAAACo3PvW7DIBQF4FdBVFFwFNnJ0IW4kbJUXfoEdQdirgMqBgQ3PxbyuxeiVF06dP107jmQqBUjUE7fwBhHri4YSRhIjSAruqaDNhAp_0gUJ19yBbI_rg7e1_ECBosdRYS_vHcWwWKuoekJRK_IIQQxse1mU82d7bCV-kIiTgZelug8T-xdoKqDsNKNrCIrUqI1uld9A8m21bzYGRjwP8Hlvm1y_b6zqSnbZdC297FsZTiVJ3gXNWpnORnK6a7YUfRfp-DOVnISHnbVEhUn9XOA8Q4K9Enhr-T-tvmpz59HuCHlGM4wf87fUt4xEm4BAAA=

v5.19.1+ (Undesired outcome)
https://svelte.dev/playground/hello-world?version=5.19.1#H4sIAAAAAAAACo3PvW7DIBQF4FdBVFFwFNnJ0IW4kbJUXfoEdQdirgMqBgQ3PxbyuxeiVF06dP107jmQqBUjUE7fwBhHri4YSRhIjSAruqaDNhAp_0gUJ19yBbI_rg7e1_ECBosdRYS_vHcWwWKuoekJRK_IIQQxse1mU82d7bCV-kIiTgZelug8T-xdoKqDsNKNrCIrUqI1uld9A8m21bzYGRjwP8Hlvm1y_b6zqSnbZdC297FsZTiVJ3gXNWpnORnK6a7YUfRfp-DOVnISHnbVEhUn9XOA8Q4K9Enhr-T-tvmpz59HuCHlGM4wf87fUt4xEm4BAAA=

Logs

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
    Memory: 1.40 GB / 7.73 GB
  Binaries:
    Node: 20.11.1 - C:\Program Files\nodejs\node.EXE     
    pnpm: 8.9.0 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (127.0.2651.74)

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions