Shopify Flow: Run Code does not understand Math.random()

Solved

Shopify Flow: Run Code does not understand Math.random()

jack_
Shopify Partner
3 0 0

In Shopify Flow, when using the action node 'Run Code' (used to run JavaScript), if I try to generate a random float with Math.random(), for some reason it always returns the same float on every single attempt: 0.8549251903236059

Is this a known issue? 

Accepted Solution (1)

paul_n
Shopify Staff
1677 184 385

This is an accepted solution.

See https://help.shopify.com/en/manual/shopify-flow/reference/actions/run-code#limitations

 

It's blocked on purpose to prevent crypto mining.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 2 (2)

paul_n
Shopify Staff
1677 184 385

This is an accepted solution.

See https://help.shopify.com/en/manual/shopify-flow/reference/actions/run-code#limitations

 

It's blocked on purpose to prevent crypto mining.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
jack_
Shopify Partner
3 0 0

That is unfortunate to hear. Thanks for letting me know Paul