## Given two numbers generate a number that is not one of the two numbers

Propose new features and changes
iseahound
Posts: 433
Joined: 13 Aug 2016, 21:04
GitHub: iseahound

### Given two numbers generate a number that is not one of the two numbers

A bit of an interesting puzzle. The most obvious solution would be to average the two numbers and add 1. But what's the best way to generate a unique looking number?

For some background: Windows stores bitmaps top down or bottom up. So I'll be writing a short snippet that sets the top left pixel, and check if that changes the top left pixel or the bottom left pixel. The value to set the pixel to should be different from the existing colors.
Helgef
Posts: 3839
Joined: 17 Jul 2016, 01:02
Contact:

### Re: Given two numbers generate a number that is not one of the two numbers

The most obvious solution would be to average the two numbers and add 1.
This would obviously not work though, i.e, for -1, 1
But what's the best way to generate a unique looking number?
Disregarding 37, all numbers are equally unique.

Code: Select all

``````something_else_than(a, b){ ; for integers
return a && b ? 0 : max(a, b) + 1
}
``````

Regarding bitmaps, I have some vague memory of the bitmaps' orientation being distinguished by them having negative or positive height.

Cheers.