Question: Came across this question previously on an interview. The requirements are to write a function that

1. Generates a number between 0..1
2. Never returns the same number
3. Can scale (called every few milliseconds and continuously for years)
4. Can use only 1mb of heap memory
5. Does not need to return as a decimal, can render directly to stdout

My idea was hacky at best which involved manipulating a string of the "0.1" then "0.11" then "0.12" etc. Since the requirements did not mention it had to be uniformly distributed, it does not need to be random. Another idea is generate a timestamp of the form yyyyMMddhhmmssSSS (where SSS is msec) then convert that to a string and prefix it with "0." . This way the values will always be unique.

It's a pretty open ended question and I'm curious how other people would tackle it.

Answer: 
Pseudo code that can do what you except *guarantee* no repeats.

1. Take your 1 MB allocation.
2. Randomly set every byte.
3. Echo to stdout as "`0.<bytes as integer string>`" (will be very long)
4. Go to #2

Your "Never returns the same number" is not guaranteed but it is extremely unlikely (1 in 2^8192) assuming a good implementation of Random.
Your method would eventually use more than 1mb of heap memory. Every way you represent numbers, if you are constrained by 1mb of heap then there is only a finite number of values. I would take the maximum ammount of memory possible, and increment the least significant bit by one on each call. That would ensure running as longer as possible before returning a repeted number.