+ 6

Is it not possible to generate a pseudo random number via a function in a functional programming language?

Because a function in such a language needs to produce the same output for a given or null input? Otherwise, can a long pseudorandom sequence be used and the function be called with a sequential input each time?

4th Nov 2019, 11:08 PM
Sonic
Sonic - avatar
3 ответов
+ 7
Happy testing Mane SoloTest
6th Nov 2019, 1:01 PM
Sonic
Sonic - avatar
+ 4
Mane SoloTest helpful in what way?
6th Nov 2019, 7:18 PM
Sonic
Sonic - avatar
+ 1
“We get the same answer twice because the underlying function [random] that’s deciding the values returned is pure; the type doesn’t permit the performance of any effects to get spooky action.” Excerpt From Haskell Programming from first principles This material may be protected by copyright. So it seems like the pseudorandom number generator is pure. I’m not sure how though.
5th Nov 2019, 12:45 AM
Rora