scratchfoundation / scratchfoundation/scratch-editor

`pick random () to ()` integer(‐ish) output with scientific notation

Open
#160 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
281
Forks
276
Avg merge
7d 8h
Merged PRs (30d)
6

Description

The pick random () to () block detects whether it should output only integers by checking whether either of its inputs contains a dot, but it’s possible to input fractional numbers in a different way, i.e. with scientific notation.

E.g. if you enter 5e-1 in its first field (and leave the second field as 10, it will “attempt” to output only integers, but they will be offset by 0.5 (outputting e.g. 1.5, 6.5, 3.5, etc.)

The expected/intuitive behavior is that it should output an arbitrary float value in the range just as if 0.5 had been entered.

pick random (5e-1) to (10) outputting 3.5
pick random (5e-1) to (10) outputting 3.285...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of the pick random () to () block and reproduce the issue with 5e-1 and 10. Done means scientific-notation fractional input produces arbitrary float values in the range, matching the behavior of an equivalent decimal input.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.