- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Suppose I have some function F that has random output on each call.
Now suppose I want to create a new function G, that given an integer, maps it exactly one of F's outputs every time.
e.g. suppose F outputs random powers of 2.
Then
G(0) = 0
G(1) = 2
G(2) = 4
etc.
This seems straightforward, but what if F doesn't output necessarily a number, but a data structure whose fields are random? Do I need to translate every single possible permutation of the data structure into a unique number in order to create G?
In the same sense, what I want to do is somehow save the random output of F into an integer, so I can always reconstruct that random output at anytime.
I would rather not want to enumerate F in order to create G--the only way I know would literally "list" out every possible output of F and then assign an integer to it. Not very efficient and not very fun.
Suppose I have some function F that has random output on each call.
Now suppose I want to create a new function G, that given an integer, maps it exactly one of F's outputs every time.
e.g. suppose F outputs random powers of 2.
Then
G(0) = 0
G(1) = 2
G(2) = 4
etc.
This seems straightforward, but what if F doesn't output necessarily a number, but a data structure whose fields are random? Do I need to translate every single possible permutation of the data structure into a unique number in order to create G?
In the same sense, what I want to do is somehow save the random output of F into an integer, so I can always reconstruct that random output at anytime.
I would rather not want to enumerate F in order to create G--the only way I know would literally "list" out every possible output of F and then assign an integer to it. Not very efficient and not very fun.