Skip to content

Instantly share code, notes, and snippets.

View frops's full-sized avatar
Focusing

Ildar Asanov frops

Focusing
View GitHub Profile
@frops
frops / get_random_item_from_array.php
Created October 9, 2019 08:45
PHP: Get random item from array
<?php
function float(float $min, float $max): float
{
$random = \mt_rand() / \mt_getrandmax() * $max;
return \max($random, $min);
}
function getRandomItem(array $array)
{
@frops
frops / lesson_1.8.13.cpp
Created July 6, 2019 13:52
Where is bug? What is wrong?
#include <iostream>
using namespace std;
int log(int a)
{
int cnt;
while (a > 1)
{
a /= 2;
cnt++;