Alexis Purslane
Alexis Purslane

Reputation: 1390

Javascript-esq random floating point number 0-1 in Racket?

I've checked out the docs for this on docs.racket-lang.org, and looked all over the internet for a possible implementation of this, but all I'm looking for is a random number generating function that generates a number between 0 and 1. For instance, in Javascript:

> Math.random()
0.16275149723514915

I'm looking for this in Racket, and I'd implement it if I could, but I just don't have the chops (yet).

Upvotes: 0

Views: 159

Answers (1)

C. K. Young
C. K. Young

Reputation: 223043

Yes, just use (random). Example usages:

> (random)
0.9007041222291202
> (random)
0.6808167485543256

Upvotes: 3

Related Questions