Contact Free trial Login

random

random(): Number

Returns a pseudo-random number greater than or equal to 0.0 and less than 1.0.

Example

This example generates a pseudo-random number and multiplies it by 1000.

Source

%dw 2.0
output application/json
---
{ price: random() * 1000 }

Output

{ "price": 65.02770292248383 }

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub