Files
T2-start-2025/C/C5 and C6 Adidas/shared/channel.c
2025-06-05 15:19:10 +02:00

16 lines
421 B
C

#include "channel.h"
#include <time.h>
#include <stdlib.h>
void channel_init(){
srand((unsigned int)time(NULL));
}
uint8_t channel_change_one_random_bit(uint8_t value){
// Generate random bit position (0-7)
uint8_t bit_position = rand() % 8;
uint8_t bit_mask = 1 << bit_position;
// XOR with the mask to flip the bit
// 01101010 with mask 00000100 becomes 01101110
return value ^ bit_mask;
}