Random module problems

I’m having a problem I’m not entirely sure is pyrevit related, but it only happens in pyrevit and the Revit Python Shell.

I noticed when I import the standard random module and try to generate a list of random numbers, either with random() or uniform(), all the results lie only within the first half of the domain. i.e. random() produces results from 0 to 0.5 instead of 0 to 1 and uniform(0,4) produces results from 0 to 2 instead of 0 to 4. Calling in dynamo works as expected.

Had my coworker test on her machine in RPS and she got the same results.

Yea seems to be happening on Revit with 2.7.7 engine. Maybe Revit is setting up something that throws it off. It seems okay with 2.7.9 and above and also 2.7.3

Very odd

Odd indeed. So I just need to download the latest IronPython to fix this?

Thanks for looking into it!

1 Like

No switch your pyRevit engine to anything other than 277. Maybe use the custom engine

1 Like