• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Bijection between integers and random output

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,342
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.
 
Status
Not open for further replies.
Back
Top