Looks like your pixels are being rendered as 0xaarrggbb not 0xrrggbbaa (so when you think you are setting alpha to 0xFF you are actually setting blue to 0xFF, hence the overall blue cast). Check your pixel format.
Another possibility is that you are assuming that, with your particular C compiler, RAND_MAX is at least 0xFFFFFF. That is not guaranteed: according to the standard RAND_MAX is allowed to be as small as 32767. If it is, your expression:
b = rnd >> 16 & 0x000000ff;
will always return zero. Of course that would result in an overall yellow cast (no blue) so there would have to be a problem with the pixel format as well if that is the explanation.
The color cast is because mapformat is the window’s pixel format (probably bgra8888), whereas your texture’s pixel format is created as rgba8888. So SDL_MapRGBA is putting the alpha channel value in the wrong place for the texture’s pixel format, giving you the color cast. Creating the textures with the same pixel format as the window fixes this, as would using the texture’s pixel format in the call to SDL_MapRGBA().
edit: also, you need to take into account pitch when setting pixels in the texture. It may be wider than width