I need a quick algorithm to select 4 random elements from a generic list. For example, I'd like to get 4 random elements from a List and then based on some calculations if elements found not valid then it should again select next 4 random elements from the list.
What is the best way to randomize the order of a generic list in C#? I've got a finite set of 75 numbers in a list I would like to assign a random order to, in order to draw them for a lottery type application.
Generating random results by weight in PHP? I know how to generate a random number in PHP but lets say I want a random number between 1-10 but I want more 3,4,5's then 8,9,10's. How is this possible? I would post what I have tried but honestly, I don't even know where to start. Why is the ROC curve two-dimensional instead of three-dimensional? There are two schools of thought on how to best extend, enhance, and reuse code in an object-oriented system:   Inheritance: extend the functionality of a class by creating a subclass. Override superclass members in the subclasses to provide new functionality. Make methods abstract/virtual to force subclasses to "fill-in-the-blanks" when the superclass wants a particular interface but is agnostic about its implementation. Aggregation: create new functionality by taking other classes and combining them into a new class. Attach an common interface to this new class for interoperability with other code.   What are the benefits, costs, and consequences of each? Are there other alternatives?  I see this debate come up on a regular basis, but I don't think it's been asked on  Stack Overflow yet (though there is some related discussion). There's also a surprising lack of good Google results for it. ubuntu 18.04 LTS bluetooth [0cf3:3004] discovery not working What are the barriers to understanding pointers and what can be done to overcome them? Why are pointers such a leading factor of confusion for many new, and even old, college level students in C or C++?  Are there any tools or thought processes that helped you understand how pointers work at the variable, function, and beyond level?  What are some good practice things that can be done to bring somebody to the level of, "Ah-hah, I got it," without getting them bogged down in the overall concept? Basically, drill like scenarios. SINGLE_EMAIL_LIMIT_EXCEEDED. What does it mean? Someone gave me a bunch of envelopes of pizza crust yeast, "specially formulated for pizza crust". The packets also say that no rise time or proofing is needed, and that it's "NOT recommended for bread baking." The ingredients are yeast, enzymes, sorbitan monostearate, l-cysteine, and ascorbic acid. It does provide a recipe for pizza crust, with just mixing and a bit of kneading.   What has actually been done to this yeast to make it work like this? (What are those enzymes?) And is there any way I can use it for other things, or is it really only good for things like pizza crust? Is it possible to walk between all three terminals in Dubai Airport without leaving airside? We are arriving into Terminal 2 on the 28th December and want to go to the business lounge in Terminal 1 before getting a flight from Terminal 3 eight hours later. Someone needs to set the record straight on what exactly antiderivatives vary by: constants functions or piecewise constant functions. Nouns can modify nouns: cat food, coffee cup, gold ring, laser surgery, flood insurance. It seems to me there are even cases where a noun sounds better than the corresponding adjective: sociology papers sounds a bit better than sociological papers.  Some noun-noun combinations don&rsquo;t work. You wouldn't say America gangsters or measurement spoons or greed crimes. If you spilled water on your keyboard you probably wouldn't call it a keyboard spill or even a water spill.  Are there rules that tell which combinations are acceptable? Co-Buyer Automobile As a co-buyer on an automobile, can the other party take full possession? Both parties names are listed as the Purchaser's. Only one purchaser signed the retail order for the motor vehicle, and if so, how can one become a no co-buyer? PHP regex delimiter, what's the point? Good day guys, i have to something like this, any idea how is this picture made ?  so it looks like negative i did invert it in photoshop but the bright side of his face was blue, so there been negative effect and smting been used to change his face to blue before nagative or smting that changed his face to normal skin color after negative ? what can it be ? what do you guys think ? THANKS ! for help. How do I forward/NAT all traffic to one interface/IP to a remote IP? I have one "server A" that has multiple IPs attached to it, like so:  eth0:0 1.1.1.1 eth0:1 1.1.1.2 eth0:2 1.1.1.3   I have another "server B" that also has multiple IPs attached to it, like so:  eth0:0 2.2.2.1 eth0:1 2.2.2.2 eth0:2 2.2.2.3   Now, I want to setup iptables on "Server A" to forward/NAT all incomming traffic on "eth0:2" to IP 2.2.2.3 on "Server B".  I have verified that "Server A" is able to "talk" to "Server B" on IP 2.2.2.3. Ping and telnet to open ports works just fine and I have the forward-flag turned on (net.ipv4.ip_forward=1)  I have tried multiple different ways, DNAT, SNAT, MASQUERADE etc, but I cannot get anything to work.  This line works fine if I try to forward traffic between IPs on the SAME server:  iptables -t nat -A PREROUTING -d 1.1.1.3 -j DNAT --to-destination 1.1.1.2   But if I switch out the "1.1.1.2" for "2.2.2.3", it does not work.  I assume that I need a second iptable rule to solve it. I have tried with the following POSTROUTING rules without any luck (not at the same time):  iptables -t nat -A POSTROUTING -d 2.2.2.3 -j MASQUERADE iptables -t nat -A POSTROUTING -d 2.2.2.3 -j SNAT --to 1.1.1.3 iptables -t nat -A POSTROUTING -j MASQUERADE   What am I missing?  EDIT 1:  I finally got it to work by using the following:  net.bridge.bridge-nf-call-iptables=0  iptables -t nat -A PREROUTING -d 1.1.1.3 -j DNAT --to-destination 2.2.2.3 iptables -t nat -A POSTROUTING -d 2.2.2.3 -j SNAT --to 1.1.1.3   However, now another problem appeared. All logs etc on server 2.2.2.3 shows that ALL traffic now comes from 1.1.1.3, like apache logs, mail logs etc. I assume this is the nature of NAT.   However, when I do standard port forwarding on my home-router to my laptop that is running apache, I see the original "requester IP" in the logs. So, how does the router do this? And how can I do the same on my server setup?  Bottom line, I want to forward all traffic from Server A (1.1.1.3) to Server B (2.2.2.3), BUT I also want to be able to see where the traffic came from on Server B (2.2.2.3), i.e the apache logs should show the original IP of the requester.  I assume I should use some other way than NAT to make this happen, and it should be possible, as even my simple home-router is able to do this.  One extra thing, the IPs attached to Server A and Server B is LOCKED to each respective server. Thus, Server A is NOT able to send out traffic FROM IP 2.2.2.3. It is locked by my provider in the router. The Software Center in Ubuntu 16.04 (Gnome Software) shows only part of the packages available. While e.g. apt list qtcreator correctly lists the corresponding package a search in Software Center finds nothing.  Is there something misconfigured? I upgraded from 15.10. Until now I have used the old Ubuntu Software Center which worked fine. Damage reduction and damage resistance: how to calculate? Assume a character has both damage reduction and damage resistance vs an incoming attack.  One example of damage reduction is the Heavy Armor Master feat:     While you are wearing heavy armor, bludgeoning, piercing, and slashing damage that you take from non magical weapons is reduced by 3.   One example of damage resistance is the blade ward cantrip:     You extend your hand and trace a sigil of warding in the air. Until the end of your next turn, you have resistance against bludgeoning, piercing, and slashing damage dealt by weapon attacks.    Let's assume a character with both effects above is hit by a nonmagical weapon attack dealing slashing damage. The attack deals 10 damage. What happens:   Damage reduction applies reducing damage to 7, then damage resistance (rounds down). Character takes 3 damage. Damage resistance applies, halving to 5, then damage reduction takes it to 2 damage. Why does a bezier curve twist when rotated? If I create a bezier curve and rotate it in edit mode it does not accordingly rotate the tilt of the handles which creates an undesirable twisting along the curve.  Here is an example using a bezier circle with a square used for a bevel object:   Here it is after being rotated 90° about the y-axis:   How do I prevent/fix this? My question is related to my previous asked one:   I have about 300 shapekeys and want to set the random value for all of them . How to do it using scripting? what is the difference between kind, type and sort Examples:        Data can be imported to and exported from the application.    Data can be imported and exported from the application.   Data can be imported to the application and exported from it.                  The manager defined the products that should be added to and removed from the store.   The manager defined the products that should be added and removed from the store.   The manager defined the products that should be added to the store and removed from it.      I assume that the third sentence is correct in my examples. My question is whether the two other sentences are correct.