#include <stdio.h>
#include<stdlib.h>
#include<time.h>

void randy(int array[] ){
int i = 0  , d = 0;
		for(i = 1 ; i <= 23 ; i++){
			
			array[i] =  1 + (rand() % 365 ); 
		}
	}

int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}



int find (int arr[]){
 int d = 0;
 	
 	for(d = 1  ;d <=23 ; d++ ){
 		
		 if(arr[d] == 	 arr[d + 1]){
		 	return 1;
		 }
	 }
	
	return 0;
}

int main(void){
	 double count_birthday = 0;
	int  people[24];
  
	srand(time(NULL));
	
	int c = 0 ;
	long double ip = 0;
	
	
	
	while(ip++ <= 1000000 ){
		

		randy(people);
		qsort (people, 25, sizeof(int), compare);
		if(find (people) == 1 ){
			count_birthday++;
		}

	}

printf("%.2lf", 	count_birthday  / 10000  );
return 0;
}
By lazy_8, 2020-03-04 13:14:05
public static returnTrue(boolean b){
    if (b){
        return true;
    } else {
        return true;
    }
}

When you want your function always returns the correct value

By kayvan goli, 2017-12-13 14:49:39
// powtierdzenie decyzji
function zapytaj(pytanie){
	if(confirm(pytanie)) return true
	else return false;
}
By first year student, 2018-10-02 21:30:46
if (responseCode / 100 == 2) {//success
    return handleSuccess();
} else if (responseCode == 401) {
    return handleNotAuthorized();
} else {
    // something else
} 
By Anonymous, 2019-01-29 09:41:13
var list = new List<string>() { // Assume some items in the list };

for (var i = 0; i < list.Count; i++)
{
    var item = list[i];
    list.Remove(item);
    
    i--;
}

Simple alternative to List.Clear()

By Taylor, 2017-12-13 07:07:56
/// <summary>
/// Returns true if any component of of Vector3 v is negative
/// </summary>
public static bool Ext_IsNegative(this Vector3 v)
{
    return v.x < 0f && v.y < 0f && v.z < 0f;
}

Either the description is wrong or the method in itself

By SwagridOfficial, 2017-12-13 13:00:34
private <T> Supplier<T> abort(Class<T> exception) {
  return () -> {
    try {
      return exception.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  };
}

...

throw abort(MyException.class).get();
By Anonymous, 2017-12-14 11:27:50
    public function getProfilePicture(Company $company, $id, $url = null) {
        // @TODO: Figure out how to do this.
        return null;
    }
By Anonymous, 2019-04-12 15:16:30
this.props.HeaderStore.setHeader(true, null, false, false, true, true,'dashboardNavigation');
By Fluttershy, 2018-01-19 08:53:26
#33 PHP +6
<?
if (ini_get('register_globals') != 1){
if ((isset($_POST) == true) && (is_array($_POST) == true)) extract($_POST, EXTR_OVERWRITE);
if ((isset($_GET) == true) && (is_array($_GET) == true)) extract($_GET, EXTR_OVERWRITE);}
By Sobak, 2015-07-21 07:59:13

"  ".split(" ");

Very weird code found multiple times in old code base.

By heldt, 2017-12-12 12:03:14

class Timer extends React.Component{
    state ={
        time: 10
    };
    setInvt = () =>{
        let t = this.state.time
        if(t<=1){
            clearInterval(this.invertal)
        }
        this.setState({time: t-1})
    }
    componentDidMount(){
        this.invertal = setInterval(this.setInvt, 1000)
    }

    render(){
        return (<label>{this.state.time}</label>)
    }
}

export {Timer}
By Anonymous, 2021-07-30 21:13:46
case ClientMessage:    
    if (*XGetAtomName(GLWin.dpy, event.xclient.message_type)
        == *"WM_PROTOCOLS")
        {   printf("Exiting sanely...\n");
            done = True;
        }
    break;

someone just want to watch the world burn

By Anonymous, 2018-01-07 13:01:05
 Map<Object, List<Element>> groupeUniqueMap =values.stream().collect(Collectors.groupingBy(this::getCompositeGroupKey, Collectors.toList()));
      if(groupeUniqueMap.containsKey(Arrays.asList(null,null,null,null,null,null,null)))
        return values;
      return doReturn();
By ThisIsFine, 2020-07-02 18:41:35
  ierr = pxmlIn->GetData(pcTag, *pTData);
  *pbDataValid = bool((ierr==0)&&(iLen>0));  // enabled if: not empty string and vaild (number?)
  if (*pbDataValid)  iErr += ierr;
By Anonymous, 2020-04-07 14:44:12