Not everyone who gives JEE wants to become an engineer, there're a couple of "JEE aspirants" who want to become scientists :/ But yeah, IISc's are most probably a better option.
So, assume that for some messed up reason, you're making something in python and speaking of randomization, the only function you have is a function that is capable of giving just 0 and 1 as it's outputs. But you need a function that gives a random natural number from 1 to any number you want.
That's where my program comes in handy 😎
Here's the code
#Program to give out a random natural number between two given natural numbers by only randomizing between 0 and 1.
import random
def randomize(a):
p1 = 1
p2 = a
while (p1 < p2):
d = p2-p1+1
if (d%2 == 0):
r = random.randint(0,1)
if (r == 0):
p2 = p1+d/2-1
else:
p1 = p1+d/2
else:
r1 = random.randint(0,1)
r2 = random.randint(0,1)
if (r1 == 0):
if (r2 == 0):
It basically uses the random.randint() function only to give a random 0 or 1 and based on that, gives a random natural number between 1 and the user's input
This version of the program gives 10 outputs.
Now, if any of you is interested, here's a small demo of how it works.
Let's say that the user enters $8$.
Now, the program will use the random.randint() function to give a 0 or 1.
Let's say that it gives a 0, so we choose the first half of 8...1 to 4.
The next time, let's say that it gives a 1, so we choose the second half...3 to 4.
Now let's say that it chooses 1, so we get the second half...aka 4, and that's it, the program will end and return 4.
In case of odd numbers, there's a slight problem. The probability that the program's output is the middle number $\left(\dfrac{n+1}{2}\right)$ is much more than any of the other numbers.
Now if our entered number is, say, 7.
then it randomizes between 0 and 1 twice...let's say that the outputs are 0 and 0 respectively.
first, it divides 7 into three parts...1 to 3, 4, and 5 to 7.
since the first output is zero, we work with two of the three parts...1 to 3, 4.
The second output is 0 too, so we work with 1 to 3. Now 3 is odd again. so the program will randomize between 0 and 1 twice again..let's say that we get 1 and 0 this time. the three parts are 1, 2 and 3. since we get 1, it means we're working with the two parts : 2,3. The next random number we got was 0, so our final output is 2.
@Anonymous Ok , so this is what I was able to come up with , see any line of type y = k would be cutting the whole graph at either 3 or 2 points , it would cut at 2 points only for y = 0 and one other y which is unknown , let it be y = k , so x² - x³ = k cubic should have 2 solutions only and condition of cubic to have repeated roots is give here :
To write a condition for a cubic to have 2 real roots, can I equate the fuction to its derivative? I.e let $y=ax^3+bx^2+cx+d$
$\frac{dy}{dx}=3ax^2+2bx+c$ setting y and the derivative equal to 0 gives:
$ax^3+bx^2+cx+d=0$ $3ax^2+2bx+c=0 \Rightarrow 3ax^2+2bx+c=ax^3+bx^2+cx+d$ however, this equati...
@Arjun Zukam hai, kaafi lambe time tak so raha tha 🙂
@Arjun I would have the same reaction 💀
@Spectre I faced the timeout errors before we had a wifi connection, on mobile data. Most probably due to a slow speed. How fast does fast.com say your connection is?
I thought you were in 12th 💀 Hemlo, fellow 11th grader 🙂
@Spectre You can use the "fixed font" button to the right of the textbox for that.
Yeah, having a PC with low specs explains why you would be getting low FPS but you were lagging in my game too ._. That usually indicates network issues, or a high ping or something.
I'm getting unstable af FPS nowadays 🙂 It's 70 fps one moment and as soon as I see an enemy, bam, 30..they pull out their gun, bam, 15, they start shooting..bam, 8. I start building...still 8 🤡
Bro wtf 💀 I get approx 80 ping every game. Middle east servers.
Alright so basically, there's this new sniper and it has some insane bullet drop. At medium range too, you have to aim the crosshair above someone's head so that when the bullet drops over the distance, it hits their head.
And the bullet is also slow af so you have to aim the crosshair towards the direction the enemy is moving in. Like, if they're moving to the right, you place the crosshair not on their body, but to it's right...cus well, slow af bullets 🤡
The new MK-7 assault rifle has a red dot sight, like in COD or PUBG. It shoots fast and is very accurate so most people love it.
The new striker pump shotgun has a slow fire rate, it's extremely inaccurate and extremely weak. The new auto shotgun takes ages to reload and feels clunky.
@Arjun I mean, I got a message today about 12th class second term boards pdf's or something but I think they sent it out to every kid whose number they have, irrespective of their class.
@Arjun Sure! It's a good movie. Some plotholes and stuff that you realize later but during the first watch, it's awesome.